Completed
Push — master ( 7187a0...60d66c )
by Mike
02:58
created

CreateBookStore::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 15
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateBookStore extends Migration
7
{
8
    public function up()
9
    {
10
        Schema::create('book_store', function (Blueprint $table) {
11
            $table->increments('id');
12
            $table->unsignedInteger('book_id');
13
            $table->unsignedInteger('store_id');
14
            $table->timestamps();
15
16
            $table->foreign('book_id')
17
                ->references('id')
18
                ->on('books')
19
                ->onUpdate('CASCADE')
20
                ->onDelete('CASCADE');
21
            $table->foreign('store_id')
22
                ->references('id')
23
                ->on('stores')
24
                ->onUpdate('CASCADE')
25
                ->onDelete('CASCADE');
26
        });
27
    }
28
29
    public function down()
30
    {
31
        //
32
    }
33
}
34