Completed
Push — master ( a54cfa...dab35b )
by Nur
09:38
created

CreateMasterVillagesTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 14
c 0
b 0
f 0
rs 9.9
cc 1
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateMasterVillagesTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('tm_villages', function (Blueprint $table) {
17
            $table->bigIncrements('id');
18
            $table->unsignedBigInteger('district_id');
19
            $table->string('name', 255);
20
            $table->string('latitude')->nullable();
21
            $table->string('longitude')->nullable();
22
            $table->timestamps();
23
        });
24
        Schema::table('tm_villages', function (Blueprint $table) {
25
            $table->foreign('district_id')
26
                ->references('id')->on('tm_districts')
27
                ->onDelete('cascade');
28
        });
29
    }
30
31
    /**
32
     * Reverse the migrations.
33
     *
34
     * @return void
35
     */
36
    public function down()
37
    {
38
        Schema::dropIfExists('tm_villages');
39
    }
40
}
41