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

CreateBookStore   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 18 1
A down() 0 2 1
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