update
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?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('dns_manager_domain') && Schema::hasColumn('dns_manager_domain', 'user_id')) {
|
||||
Schema::table('dns_manager_domain', function (Blueprint $table) {
|
||||
try {
|
||||
$table->dropIndex(['user_id']);
|
||||
} catch (\Throwable) {
|
||||
// index may have a different generated name; ignore
|
||||
}
|
||||
$table->dropColumn('user_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::hasTable('dns_manager_domain') && ! Schema::hasColumn('dns_manager_domain', 'user_id')) {
|
||||
Schema::table('dns_manager_domain', function (Blueprint $table) {
|
||||
$table->tinyInteger('user_id')->default(0)->index()->after('domain_name');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user