This commit is contained in:
2026-06-06 22:06:53 +03:30
parent 6a92116535
commit 7acde1ce9d
7 changed files with 219 additions and 0 deletions
@@ -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);
}
}
});
}
};