- Migration (0114): TRUNCATE season_template_sports before adding NOT NULL sport_id column to prevent failure on non-empty tables - findDraftableSportsSeasonBySportId: add orderBy(year DESC, draftOn DESC) so the newest season is returned deterministically when multiple draft windows overlap - leagues/new.tsx loader: build a Map from the already-fetched allSportsSeasons instead of firing N×M per-sport DB queries (eliminates ~30 redundant queries) - schema: add UNIQUE(templateId, sportId) on season_template_sports to prevent duplicate sport entries via concurrent requests - schema: add UNIQUE(name) on season_templates so import merge-mode lookup by name is unambiguous (migration 0115) https://claude.ai/code/session_01CoRLHERakMncbPs877izvw
2 lines
No EOL
281 B
SQL
2 lines
No EOL
281 B
SQL
CREATE UNIQUE INDEX IF NOT EXISTS "season_template_sports_template_sport_unique" ON "season_template_sports" USING btree ("template_id","sport_id");--> statement-breakpoint
|
|
CREATE UNIQUE INDEX IF NOT EXISTS "season_templates_name_unique" ON "season_templates" USING btree ("name"); |