-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #427 from bakaphp/warehouse-channels-update
- Loading branch information
Showing
20 changed files
with
620 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
database/migrations/Inventory/2023_06_22_223035_update_product_variants_warehouses.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class () extends Migration { | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('products_variants_warehouses', function (Blueprint $table) { | ||
Schema::disableForeignKeyConstraints(); | ||
|
||
$table->dropForeign('products_variants_warehouses_warehouses_id_foreign'); | ||
$table->dropForeign('products_variants_warehouses_products_variants_id_foreign'); | ||
|
||
$table->dropPrimary(); | ||
Schema::enableForeignKeyConstraints(); | ||
}); | ||
|
||
Schema::table('products_variants_warehouses', function (Blueprint $table) { | ||
Schema::disableForeignKeyConstraints(); | ||
$table->id()->first(); | ||
$table->foreign('products_variants_id')->references('id')->on('products_variants'); | ||
$table->foreign('warehouses_id')->references('id')->on('warehouses'); | ||
$table->unique(['products_variants_id', 'warehouses_id'], 'product_variants_warehouses_unique'); | ||
Schema::enableForeignKeyConstraints(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
// | ||
} | ||
}; |
42 changes: 42 additions & 0 deletions
42
database/migrations/Inventory/2023_06_27_164405_update_product_variants_channels.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class () extends Migration { | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
Schema::table('products_variants_channels', function (Blueprint $table) { | ||
Schema::disableForeignKeyConstraints(); | ||
$table->dropForeign('products_variants_channels_products_variants_id_foreign'); | ||
$table->dropForeign('products_variants_channels_warehouses_id_foreign'); | ||
$table->dropForeign('products_variants_channels_channels_id_foreign'); | ||
$table->dropPrimary(); | ||
$table->dropColumn(['products_variants_id', 'warehouses_id']); | ||
|
||
Schema::enableForeignKeyConstraints(); | ||
}); | ||
Schema::table('products_variants_channels', function (Blueprint $table) { | ||
Schema::disableForeignKeyConstraints(); | ||
|
||
$table->bigInteger('product_variants_warehouse_id')->unsigned()->after('channels_id'); | ||
$table->foreign('product_variants_warehouse_id')->references('id')->on('products_variants_warehouses'); | ||
$table->foreign('channels_id')->references('id')->on('channels'); | ||
|
||
$table->unique(['product_variants_warehouse_id', 'channels_id'], 'variants_warehouse_channel'); | ||
Schema::enableForeignKeyConstraints(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
// | ||
} | ||
}; |
41 changes: 41 additions & 0 deletions
41
database/migrations/Inventory/2023_07_10_033443_update_variant_channel_price.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class () extends Migration { | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('products_variants_channels', function (Blueprint $table) { | ||
$table->double('price', 8, 2)->default(0.00)->change(); | ||
}); | ||
|
||
Schema::table('products_variants_warehouses', function (Blueprint $table) { | ||
$table->double('price', 8, 2)->default(0.00)->change(); | ||
$table->integer('position')->default(0)->change(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('products_variants_channels', function (Blueprint $table) { | ||
$table->double('price', 8, 2)->change(); | ||
}); | ||
|
||
Schema::table('products_variants_warehouses', function (Blueprint $table) { | ||
$table->double('price', 8, 2)->change(); | ||
$table->integer('position')->change(); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.