Conditions | 1 |
Paths | 1 |
Total Lines | 30 |
Code Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | public function up() |
||
15 | { |
||
16 | Schema::create('product_variations', function (Blueprint $table) { |
||
17 | $table->bigIncrements('id'); |
||
18 | $table->unsignedBigInteger('product_id'); |
||
19 | $table->unsignedBigInteger('product_sku_id'); |
||
20 | $table->unsignedBigInteger('product_attribute_id'); |
||
21 | $table->unsignedBigInteger('product_attribute_value_id'); |
||
22 | |||
23 | $table->foreign('product_id') |
||
24 | ->references('id') |
||
25 | ->on('products') |
||
26 | ->onDelete('cascade'); |
||
27 | |||
28 | $table->foreign('product_sku_id') |
||
29 | ->references('id') |
||
30 | ->on('product_skus') |
||
31 | ->onDelete('cascade'); |
||
32 | |||
33 | $table->foreign('product_attribute_id') |
||
34 | ->references('id') |
||
35 | ->on('product_attributes') |
||
36 | ->onDelete('cascade'); |
||
37 | |||
38 | $table->foreign('product_attribute_value_id') |
||
39 | ->references('id') |
||
40 | ->on('product_attribute_values') |
||
41 | ->onDelete('cascade'); |
||
42 | |||
43 | $table->unique(['product_id', 'product_attribute_id', 'product_sku_id'], 'product_variation_sku'); |
||
44 | // $table->unique(['product_id', 'product_attribute_id', 'product_attribute_value_id'], 'product_variation_attribute'); |
||
58 |