@@ -6,32 +6,32 @@ |
||
6 | 6 | |
7 | 7 | class CreateAttributeValuesTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('product_attribute_values', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->unsignedBigInteger('product_attribute_id'); |
|
19 | - $table->string('value'); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('product_attribute_values', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->unsignedBigInteger('product_attribute_id'); |
|
19 | + $table->string('value'); |
|
20 | 20 | |
21 | - $table->foreign('product_attribute_id') |
|
22 | - ->references('id') |
|
23 | - ->on('product_attributes') |
|
24 | - ->onDelete('cascade'); |
|
25 | - }); |
|
26 | - } |
|
21 | + $table->foreign('product_attribute_id') |
|
22 | + ->references('id') |
|
23 | + ->on('product_attributes') |
|
24 | + ->onDelete('cascade'); |
|
25 | + }); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Reverse the migrations. |
|
30 | - * |
|
31 | - * @return void |
|
32 | - */ |
|
33 | - public function down() |
|
34 | - { |
|
35 | - Schema::dropIfExists('product_attribute_values'); |
|
36 | - } |
|
28 | + /** |
|
29 | + * Reverse the migrations. |
|
30 | + * |
|
31 | + * @return void |
|
32 | + */ |
|
33 | + public function down() |
|
34 | + { |
|
35 | + Schema::dropIfExists('product_attribute_values'); |
|
36 | + } |
|
37 | 37 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_attribute_values', function (Blueprint $table) { |
|
16 | + Schema::create('product_attribute_values', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->unsignedBigInteger('product_attribute_id'); |
19 | 19 | $table->string('value'); |
@@ -6,28 +6,28 @@ |
||
6 | 6 | |
7 | 7 | class CreateWarehousesTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('warehouses', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->string('name'); |
|
19 | - $table->mediumText('description'); |
|
20 | - $table->timestamps(); |
|
21 | - }); |
|
22 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('warehouses', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->string('name'); |
|
19 | + $table->mediumText('description'); |
|
20 | + $table->timestamps(); |
|
21 | + }); |
|
22 | + } |
|
23 | 23 | |
24 | - /** |
|
25 | - * Reverse the migrations. |
|
26 | - * |
|
27 | - * @return void |
|
28 | - */ |
|
29 | - public function down() |
|
30 | - { |
|
31 | - Schema::dropIfExists('warehouses'); |
|
32 | - } |
|
24 | + /** |
|
25 | + * Reverse the migrations. |
|
26 | + * |
|
27 | + * @return void |
|
28 | + */ |
|
29 | + public function down() |
|
30 | + { |
|
31 | + Schema::dropIfExists('warehouses'); |
|
32 | + } |
|
33 | 33 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('warehouses', function (Blueprint $table) { |
|
16 | + Schema::create('warehouses', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->mediumText('description'); |
@@ -6,52 +6,52 @@ |
||
6 | 6 | |
7 | 7 | class CreateProductVariantsTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
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'); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
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 | 22 | |
23 | - $table->foreign('product_id') |
|
24 | - ->references('id') |
|
25 | - ->on('products') |
|
26 | - ->onDelete('cascade'); |
|
23 | + $table->foreign('product_id') |
|
24 | + ->references('id') |
|
25 | + ->on('products') |
|
26 | + ->onDelete('cascade'); |
|
27 | 27 | |
28 | - $table->foreign('product_sku_id') |
|
29 | - ->references('id') |
|
30 | - ->on('product_skus') |
|
31 | - ->onDelete('cascade'); |
|
28 | + $table->foreign('product_sku_id') |
|
29 | + ->references('id') |
|
30 | + ->on('product_skus') |
|
31 | + ->onDelete('cascade'); |
|
32 | 32 | |
33 | - $table->foreign('product_attribute_id') |
|
34 | - ->references('id') |
|
35 | - ->on('product_attributes') |
|
36 | - ->onDelete('cascade'); |
|
33 | + $table->foreign('product_attribute_id') |
|
34 | + ->references('id') |
|
35 | + ->on('product_attributes') |
|
36 | + ->onDelete('cascade'); |
|
37 | 37 | |
38 | - $table->foreign('product_attribute_value_id') |
|
39 | - ->references('id') |
|
40 | - ->on('product_attribute_values') |
|
41 | - ->onDelete('cascade'); |
|
38 | + $table->foreign('product_attribute_value_id') |
|
39 | + ->references('id') |
|
40 | + ->on('product_attribute_values') |
|
41 | + ->onDelete('cascade'); |
|
42 | 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'); |
|
45 | - }); |
|
46 | - } |
|
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'); |
|
45 | + }); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * Reverse the migrations. |
|
50 | - * |
|
51 | - * @return void |
|
52 | - */ |
|
53 | - public function down() |
|
54 | - { |
|
55 | - Schema::dropIfExists('product_variants'); |
|
56 | - } |
|
48 | + /** |
|
49 | + * Reverse the migrations. |
|
50 | + * |
|
51 | + * @return void |
|
52 | + */ |
|
53 | + public function down() |
|
54 | + { |
|
55 | + Schema::dropIfExists('product_variants'); |
|
56 | + } |
|
57 | 57 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_variations', function (Blueprint $table) { |
|
16 | + Schema::create('product_variations', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->unsignedBigInteger('product_id'); |
19 | 19 | $table->unsignedBigInteger('product_sku_id'); |
@@ -6,37 +6,37 @@ |
||
6 | 6 | |
7 | 7 | class CreateProductsTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('products', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->unsignedBigInteger('category_id'); |
|
19 | - $table->string('name'); |
|
20 | - $table->string('slug')->unique(); |
|
21 | - $table->mediumText('short_description')->nullable(); |
|
22 | - $table->text('description')->nullable(); |
|
23 | - $table->boolean('is_active'); |
|
24 | - $table->timestamps(); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('products', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->unsignedBigInteger('category_id'); |
|
19 | + $table->string('name'); |
|
20 | + $table->string('slug')->unique(); |
|
21 | + $table->mediumText('short_description')->nullable(); |
|
22 | + $table->text('description')->nullable(); |
|
23 | + $table->boolean('is_active'); |
|
24 | + $table->timestamps(); |
|
25 | 25 | |
26 | - $table->foreign('category_id') |
|
27 | - ->references('id') |
|
28 | - ->on('product_categories') |
|
29 | - ->onDelete('cascade'); |
|
30 | - }); |
|
31 | - } |
|
26 | + $table->foreign('category_id') |
|
27 | + ->references('id') |
|
28 | + ->on('product_categories') |
|
29 | + ->onDelete('cascade'); |
|
30 | + }); |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * Reverse the migrations. |
|
35 | - * |
|
36 | - * @return void |
|
37 | - */ |
|
38 | - public function down() |
|
39 | - { |
|
40 | - Schema::dropIfExists('products'); |
|
41 | - } |
|
33 | + /** |
|
34 | + * Reverse the migrations. |
|
35 | + * |
|
36 | + * @return void |
|
37 | + */ |
|
38 | + public function down() |
|
39 | + { |
|
40 | + Schema::dropIfExists('products'); |
|
41 | + } |
|
42 | 42 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('products', function (Blueprint $table) { |
|
16 | + Schema::create('products', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->unsignedBigInteger('category_id'); |
19 | 19 | $table->string('name'); |
@@ -6,35 +6,35 @@ |
||
6 | 6 | |
7 | 7 | class CreateCategoriesTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('product_categories', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->string('name'); |
|
19 | - $table->string('slug')->unique(); |
|
20 | - $table->mediumText('description')->nullable(); |
|
21 | - $table->unsignedBigInteger('parent_id')->nullable(); |
|
22 | - $table->timestamps(); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('product_categories', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->string('name'); |
|
19 | + $table->string('slug')->unique(); |
|
20 | + $table->mediumText('description')->nullable(); |
|
21 | + $table->unsignedBigInteger('parent_id')->nullable(); |
|
22 | + $table->timestamps(); |
|
23 | 23 | |
24 | - $table->foreign('parent_id') |
|
25 | - ->references('id') |
|
26 | - ->on('product_categories') |
|
27 | - ->onDelete('cascade'); |
|
28 | - }); |
|
29 | - } |
|
24 | + $table->foreign('parent_id') |
|
25 | + ->references('id') |
|
26 | + ->on('product_categories') |
|
27 | + ->onDelete('cascade'); |
|
28 | + }); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Reverse the migrations. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function down() |
|
37 | - { |
|
38 | - Schema::dropIfExists('product_categories'); |
|
39 | - } |
|
31 | + /** |
|
32 | + * Reverse the migrations. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function down() |
|
37 | + { |
|
38 | + Schema::dropIfExists('product_categories'); |
|
39 | + } |
|
40 | 40 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_categories', function (Blueprint $table) { |
|
16 | + Schema::create('product_categories', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->string('slug')->unique(); |
@@ -6,35 +6,35 @@ |
||
6 | 6 | |
7 | 7 | class CreateProductSkusTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('product_skus', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->unsignedBigInteger('product_id'); |
|
19 | - $table->string('code')->unique(); |
|
20 | - $table->decimal('price', 8, 2)->default(0); |
|
21 | - $table->decimal('cost', 8, 2)->default(0); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('product_skus', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->unsignedBigInteger('product_id'); |
|
19 | + $table->string('code')->unique(); |
|
20 | + $table->decimal('price', 8, 2)->default(0); |
|
21 | + $table->decimal('cost', 8, 2)->default(0); |
|
22 | 22 | |
23 | 23 | |
24 | - $table->foreign('product_id') |
|
25 | - ->references('id') |
|
26 | - ->on('products') |
|
27 | - ->onDelete('cascade'); |
|
28 | - }); |
|
29 | - } |
|
24 | + $table->foreign('product_id') |
|
25 | + ->references('id') |
|
26 | + ->on('products') |
|
27 | + ->onDelete('cascade'); |
|
28 | + }); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Reverse the migrations. |
|
33 | - * |
|
34 | - * @return void |
|
35 | - */ |
|
36 | - public function down() |
|
37 | - { |
|
38 | - Schema::dropIfExists('product_skus'); |
|
39 | - } |
|
31 | + /** |
|
32 | + * Reverse the migrations. |
|
33 | + * |
|
34 | + * @return void |
|
35 | + */ |
|
36 | + public function down() |
|
37 | + { |
|
38 | + Schema::dropIfExists('product_skus'); |
|
39 | + } |
|
40 | 40 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_skus', function (Blueprint $table) { |
|
16 | + Schema::create('product_skus', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->unsignedBigInteger('product_id'); |
19 | 19 | $table->string('code')->unique(); |
@@ -6,45 +6,45 @@ |
||
6 | 6 | |
7 | 7 | class CreateInventoryStocksTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('inventory_stocks', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->unsignedBigInteger('warehouse_id'); |
|
19 | - $table->unsignedBigInteger('product_sku_id'); |
|
20 | - $table->integer('quantity')->default(0); |
|
21 | - |
|
22 | - $table->string('aisle')->nullable(); |
|
23 | - $table->string('row')->nullable(); |
|
24 | - |
|
25 | - $table->timestamps(); |
|
26 | - |
|
27 | - $table->foreign('product_sku_id') |
|
28 | - ->references('id') |
|
29 | - ->on('product_skus') |
|
30 | - ->onDelete('cascade'); |
|
31 | - |
|
32 | - $table->foreign('warehouse_id') |
|
33 | - ->references('id') |
|
34 | - ->on('warehouses') |
|
35 | - ->onDelete('cascade'); |
|
36 | - |
|
37 | - $table->unique(['product_sku_id', 'warehouse_id'], 'product_warehouse_key'); |
|
38 | - }); |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * Reverse the migrations. |
|
43 | - * |
|
44 | - * @return void |
|
45 | - */ |
|
46 | - public function down() |
|
47 | - { |
|
48 | - Schema::dropIfExists('inventory_stocks'); |
|
49 | - } |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('inventory_stocks', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->unsignedBigInteger('warehouse_id'); |
|
19 | + $table->unsignedBigInteger('product_sku_id'); |
|
20 | + $table->integer('quantity')->default(0); |
|
21 | + |
|
22 | + $table->string('aisle')->nullable(); |
|
23 | + $table->string('row')->nullable(); |
|
24 | + |
|
25 | + $table->timestamps(); |
|
26 | + |
|
27 | + $table->foreign('product_sku_id') |
|
28 | + ->references('id') |
|
29 | + ->on('product_skus') |
|
30 | + ->onDelete('cascade'); |
|
31 | + |
|
32 | + $table->foreign('warehouse_id') |
|
33 | + ->references('id') |
|
34 | + ->on('warehouses') |
|
35 | + ->onDelete('cascade'); |
|
36 | + |
|
37 | + $table->unique(['product_sku_id', 'warehouse_id'], 'product_warehouse_key'); |
|
38 | + }); |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * Reverse the migrations. |
|
43 | + * |
|
44 | + * @return void |
|
45 | + */ |
|
46 | + public function down() |
|
47 | + { |
|
48 | + Schema::dropIfExists('inventory_stocks'); |
|
49 | + } |
|
50 | 50 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('inventory_stocks', function (Blueprint $table) { |
|
16 | + Schema::create('inventory_stocks', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->unsignedBigInteger('warehouse_id'); |
19 | 19 | $table->unsignedBigInteger('product_sku_id'); |
@@ -6,32 +6,32 @@ |
||
6 | 6 | |
7 | 7 | class CreateAttributesTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('product_attributes', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->unsignedBigInteger('product_id'); |
|
19 | - $table->string('name'); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('product_attributes', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->unsignedBigInteger('product_id'); |
|
19 | + $table->string('name'); |
|
20 | 20 | |
21 | - $table->foreign('product_id') |
|
22 | - ->references('id') |
|
23 | - ->on('products') |
|
24 | - ->onDelete('cascade'); |
|
25 | - }); |
|
26 | - } |
|
21 | + $table->foreign('product_id') |
|
22 | + ->references('id') |
|
23 | + ->on('products') |
|
24 | + ->onDelete('cascade'); |
|
25 | + }); |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * Reverse the migrations. |
|
30 | - * |
|
31 | - * @return void |
|
32 | - */ |
|
33 | - public function down() |
|
34 | - { |
|
35 | - Schema::dropIfExists('product_attributes'); |
|
36 | - } |
|
28 | + /** |
|
29 | + * Reverse the migrations. |
|
30 | + * |
|
31 | + * @return void |
|
32 | + */ |
|
33 | + public function down() |
|
34 | + { |
|
35 | + Schema::dropIfExists('product_attributes'); |
|
36 | + } |
|
37 | 37 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_attributes', function (Blueprint $table) { |
|
16 | + Schema::create('product_attributes', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->unsignedBigInteger('product_id'); |
19 | 19 | $table->string('name'); |
@@ -6,38 +6,38 @@ |
||
6 | 6 | |
7 | 7 | class CreateInventoryStockMovementsTable extends Migration |
8 | 8 | { |
9 | - /** |
|
10 | - * Run the migrations. |
|
11 | - * |
|
12 | - * @return void |
|
13 | - */ |
|
14 | - public function up() |
|
15 | - { |
|
16 | - Schema::create('inventory_stock_movements', function (Blueprint $table) { |
|
17 | - $table->bigIncrements('id'); |
|
18 | - $table->unsignedBigInteger('stock_id'); |
|
19 | - $table->integer('before')->default(0); |
|
20 | - $table->integer('after')->default(0); |
|
21 | - $table->decimal('cost', 8, 2)->default(0)->nullable(); |
|
22 | - $table->string('reason')->nullable(); |
|
9 | + /** |
|
10 | + * Run the migrations. |
|
11 | + * |
|
12 | + * @return void |
|
13 | + */ |
|
14 | + public function up() |
|
15 | + { |
|
16 | + Schema::create('inventory_stock_movements', function (Blueprint $table) { |
|
17 | + $table->bigIncrements('id'); |
|
18 | + $table->unsignedBigInteger('stock_id'); |
|
19 | + $table->integer('before')->default(0); |
|
20 | + $table->integer('after')->default(0); |
|
21 | + $table->decimal('cost', 8, 2)->default(0)->nullable(); |
|
22 | + $table->string('reason')->nullable(); |
|
23 | 23 | |
24 | 24 | |
25 | - $table->timestamps(); |
|
25 | + $table->timestamps(); |
|
26 | 26 | |
27 | - $table->foreign('stock_id') |
|
28 | - ->references('id') |
|
29 | - ->on('inventory_stocks') |
|
30 | - ->onDelete('cascade'); |
|
31 | - }); |
|
32 | - } |
|
27 | + $table->foreign('stock_id') |
|
28 | + ->references('id') |
|
29 | + ->on('inventory_stocks') |
|
30 | + ->onDelete('cascade'); |
|
31 | + }); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Reverse the migrations. |
|
36 | - * |
|
37 | - * @return void |
|
38 | - */ |
|
39 | - public function down() |
|
40 | - { |
|
41 | - Schema::dropIfExists('inventory_stock_movements'); |
|
42 | - } |
|
34 | + /** |
|
35 | + * Reverse the migrations. |
|
36 | + * |
|
37 | + * @return void |
|
38 | + */ |
|
39 | + public function down() |
|
40 | + { |
|
41 | + Schema::dropIfExists('inventory_stock_movements'); |
|
42 | + } |
|
43 | 43 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('inventory_stock_movements', function (Blueprint $table) { |
|
16 | + Schema::create('inventory_stock_movements', function(Blueprint $table) { |
|
17 | 17 | $table->bigIncrements('id'); |
18 | 18 | $table->unsignedBigInteger('stock_id'); |
19 | 19 | $table->integer('before')->default(0); |