fix: 修正空白的 add_username_to_users_table migration 檔案

This commit is contained in:
sky121113 2026-01-12 13:11:01 +08:00
parent d3684385b2
commit 11491e07aa

View File

@ -11,9 +11,11 @@ return new class extends Migration
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
if (!Schema::hasColumn('users', 'username')) {
Schema::table('users', function (Blueprint $table) {
$table->string('username')->unique()->nullable()->after('id');
});
}
}
/**
@ -21,8 +23,10 @@ return new class extends Migration
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
//
});
if (Schema::hasColumn('users', 'username')) {
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('username');
});
}
}
};