brackt/drizzle/0115_spooky_spot.sql
Claude 553c565951
Some checks failed
🚀 Deploy / 🧪 Test (pull_request) Successful in 3m11s
🚀 Deploy / ʦ🔍 Typecheck & Lint (pull_request) Failing after 51s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
Fix 5 code review issues in sport-based template conversion
- 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
2026-06-04 18:14:14 +00:00

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");