fix bug in 22/4
This commit is contained in:
@@ -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
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('products')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('products', 'has_physical_delivery')) {
|
||||
$table->boolean('has_physical_delivery')->default(false);
|
||||
}
|
||||
if (! Schema::hasColumn('products', 'min_physical_delivery_grams')) {
|
||||
$table->decimal('min_physical_delivery_grams', 12, 3)->nullable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('products')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('products', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('products', 'min_physical_delivery_grams')) {
|
||||
$table->dropColumn('min_physical_delivery_grams');
|
||||
}
|
||||
if (Schema::hasColumn('products', 'has_physical_delivery')) {
|
||||
$table->dropColumn('has_physical_delivery');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user