CreateCategoryProductTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php namespace Bedard\Shop\Updates;
2
3
use October\Rain\Database\Schema\Blueprint;
4
use October\Rain\Database\Updates\Migration;
5
use Schema;
6
7
class CreateCategoryProductTable extends Migration
8
{
9
    public function up()
10
    {
11
        Schema::create('bedard_shop_category_product', function (Blueprint $table) {
12
            $table->engine = 'InnoDB';
13
            $table->integer('category_id')->unsigned()->nullable();
14
            $table->integer('product_id')->unsigned()->nullable();
15
            $table->boolean('is_inherited')->index()->default(false);
16
            $table->primary(['category_id', 'product_id'], 'category_product');
17
        });
18
    }
19
20
    public function down()
21
    {
22
        Schema::dropIfExists('bedard_shop_category_product');
23
    }
24
}
25