CreateTrackerGeoipTable::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 CreateTrackerGeoipTable extends Migration
6
{
7
    /**
8
     * Table related to this migration.
9
     *
10
     * @var string
11
     */
12
    private $table = 'tracker_geoip';
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->double('latitude')->nullable()->index();
27
                $table->double('longitude')->nullable()->index();
28
29
                $table->string('country_code', 2)->nullable()->index();
30
                $table->string('country_code3', 3)->nullable()->index();
31
                $table->string('country_name')->nullable()->index();
32
                $table->string('region', 2)->nullable();
33
                $table->string('city', 50)->nullable()->index();
34
                $table->string('postal_code', 20)->nullable();
35
                $table->bigInteger('area_code')->nullable();
36
                $table->double('dma_code')->nullable();
37
                $table->double('metro_code')->nullable();
38
                $table->string('continent_code', 2)->nullable();
39
40
                $table->timestamps();
41
                $table->index('created_at');
42
                $table->index('updated_at');
43
            }
44
        );
45
    }
46
47
    /**
48
     * Reverse the migrations.
49
     *
50
     * @return void
51
     */
52
    public function migrateDown()
53
    {
54
        $this->drop($this->table);
55
    }
56
}
57