This commit is contained in:
baodev0
2026-06-22 09:55:11 +07:00
parent 0c436153c6
commit 776b1a6807
12 changed files with 491 additions and 10 deletions
@@ -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');
});
}
}
};