added gholak
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?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('funds')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('funds', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('funds', 'product_id')) {
|
||||
$table->unsignedBigInteger('product_id')->nullable()->after('customer_id');
|
||||
$table->index('product_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('funds') || ! Schema::hasColumn('funds', 'product_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('funds', function (Blueprint $table) {
|
||||
$table->dropIndex(['product_id']);
|
||||
$table->dropColumn('product_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user