fix: 修正空白的 add_username_to_users_table migration 檔案
All checks were successful
Star-Cloud-Deploy-System / deploy-demo (push) Successful in 47s
Star-Cloud-Deploy-System / deploy-production (push) Has been skipped

This commit is contained in:
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');
});
}
}
};