CreateTrackerDevicesTable::migrateDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
use PragmaRX\Tracker\Support\Migration;
4
5
class CreateTrackerDevicesTable extends Migration
6
{
7
    /**
8
     * Table related to this migration.
9
     *
10
     * @var string
11
     */
12
    private $table = 'tracker_devices';
13
14
    /**
15
     * Run the migrations.
16
     *
17
     * @return void
18
     */
19
    public function migrateUp()
20
    {
21
        $this->builder->create(
22
            $this->table,
23
            function ($table) {
24
                $table->bigIncrements('id');
25
26
                $table->string('kind', 16)->index();
27
                $table->string('model', 64)->index();
28
                $table->string('platform', 64)->index();
29
                $table->string('platform_version', 16)->index();
30
                $table->boolean('is_mobile');
31
32
                $table->unique(['kind', 'model', 'platform', 'platform_version']);
33
34
                $table->timestamps();
35
                $table->index('created_at');
36
                $table->index('updated_at');
37
            }
38
        );
39
    }
40
41
    /**
42
     * Reverse the migrations.
43
     *
44
     * @return void
45
     */
46
    public function migrateDown()
47
    {
48
        $this->drop($this->table);
49
    }
50
}
51