parent
32a29e453a
commit
8afcceeb82
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* 人员管理按赛区配置依赖这些列。生产若只发了代码未跑 2026_08_26 迁移,
|
||||
* GET /admins?event_location= 与 reviewer-scope-region-counts 会 500。
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (Schema::hasTable('reviewer_scopes') && ! Schema::hasColumn('reviewer_scopes', 'event_location')) {
|
||||
Schema::table('reviewer_scopes', function (Blueprint $table) {
|
||||
$table->string('event_location', 64)->nullable()->after('track_code');
|
||||
$table->index(['competition_id', 'event_location'], 'idx_rev_scope_comp_location');
|
||||
});
|
||||
}
|
||||
|
||||
if (! Schema::hasTable('competition_admins')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('competition_admins', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('competition_admins', 'mobile')) {
|
||||
$table->string('mobile', 20)->nullable()->after('name');
|
||||
}
|
||||
if (! Schema::hasColumn('competition_admins', 'event_location')) {
|
||||
$after = Schema::hasColumn('competition_admins', 'mobile') ? 'mobile' : 'name';
|
||||
$table->string('event_location', 64)->nullable()->after($after);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
// 列由 2026_08_26_100000_add_event_location_to_people_tables 管理,此处不回滚以免误删。
|
||||
}
|
||||
};
|
||||
Loading…
Reference in new issue