Completed
Push — master ( 9697ab...60ecca )
by Mike
11:00 queued 04:55
created

CreateBookStore   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
dl 0
loc 25
rs 10
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