Guard demo seed migrations
This commit is contained in:
@@ -10,6 +10,13 @@ public partial class SeedRealisticDemoScenario : Migration
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
"""
|
||||
DO $vtsa_seed$
|
||||
BEGIN
|
||||
IF EXISTS (SELECT 1 FROM "Seasons" WHERE "Year" IN (2025, 2026)) THEN
|
||||
RAISE NOTICE 'Existing seasons detected; skipping realistic demo seed.';
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
INSERT INTO "Seasons" (
|
||||
"Id", "Year", "Name", "IsDemo", "IsCurrent", "IsCommunityOnly", "CurrentPhase",
|
||||
"NominationStartsAt", "NominationEndsAt", "VotingStartsAt", "VotingEndsAt",
|
||||
@@ -240,6 +247,8 @@ public partial class SeedRealisticDemoScenario : Migration
|
||||
SELECT setval(pg_get_serial_sequence('"ShowactApplications"', 'Id'), COALESCE((SELECT MAX("Id") FROM "ShowactApplications"), 1));
|
||||
SELECT setval(pg_get_serial_sequence('"Sponsors"', 'Id'), COALESCE((SELECT MAX("Id") FROM "Sponsors"), 1));
|
||||
SELECT setval(pg_get_serial_sequence('"RiskFlags"', 'Id'), COALESCE((SELECT MAX("Id") FROM "RiskFlags"), 1));
|
||||
END;
|
||||
$vtsa_seed$;
|
||||
"""
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user