fix bug
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (!Schema::hasTable('products')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('products', 'order_limit_enabled')) {
|
||||
$table->boolean('order_limit_enabled')->default(false)->after('percent_fee_buy');
|
||||
}
|
||||
if (!Schema::hasColumn('products', 'min_order_cash')) {
|
||||
$table->unsignedBigInteger('min_order_cash')->nullable()->after('order_limit_enabled');
|
||||
}
|
||||
if (!Schema::hasColumn('products', 'max_order_cash')) {
|
||||
$table->unsignedBigInteger('max_order_cash')->nullable()->after('min_order_cash');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (!Schema::hasTable('products')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
$columns = ['order_limit_enabled', 'min_order_cash', 'max_order_cash'];
|
||||
foreach ($columns as $column) {
|
||||
if (Schema::hasColumn('products', $column)) {
|
||||
$table->dropColumn($column);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user