Fixes #262 * Replace isDraftable boolean with draftOn/draftOff date fields on sport seasons Admins can now schedule when a sport season becomes available for drafting by setting explicit open and close dates instead of a manual toggle. https://claude.ai/code/session_01LHYgpyimF8v8odUB6kj8Qc * Address code review feedback on draft window implementation - sports-data-sync: use unambiguous past placeholder dates for synced seasons, with a comment explaining the intent - sports-season model: remove redundant top-level lte/gte imports (callback form already supplies them) - _journal.json: add missing trailing newline - sports-season test: mock ~/database/schema instead of stubbing all drizzle builder functions, matching the established pattern in the codebase - admin list: compute today once in component body instead of per-row https://claude.ai/code/session_01LHYgpyimF8v8odUB6kj8Qc * Fix: restore lte/gte imports removed in review cleanup The relational query where-callback in this version of Drizzle does not expose lte/gte as helper args, so they must be imported from drizzle-orm. Removing them broke CI TypeScript. https://claude.ai/code/session_01LHYgpyimF8v8odUB6kj8Qc --------- Co-authored-by: Claude <noreply@anthropic.com>
19 lines
843 B
SQL
19 lines
843 B
SQL
-- Step 1: Add new columns as nullable
|
|
ALTER TABLE "sports_seasons" ADD COLUMN "draft_on" date;--> statement-breakpoint
|
|
ALTER TABLE "sports_seasons" ADD COLUMN "draft_off" date;--> statement-breakpoint
|
|
|
|
-- Step 2: Backfill data based on existing is_draftable flag
|
|
UPDATE "sports_seasons"
|
|
SET "draft_on" = '2026-04-06', "draft_off" = '2099-12-31'
|
|
WHERE "is_draftable" = true;--> statement-breakpoint
|
|
|
|
UPDATE "sports_seasons"
|
|
SET "draft_on" = '2020-01-01', "draft_off" = '2020-12-31'
|
|
WHERE "is_draftable" = false;--> statement-breakpoint
|
|
|
|
-- Step 3: Apply NOT NULL constraints
|
|
ALTER TABLE "sports_seasons" ALTER COLUMN "draft_on" SET NOT NULL;--> statement-breakpoint
|
|
ALTER TABLE "sports_seasons" ALTER COLUMN "draft_off" SET NOT NULL;--> statement-breakpoint
|
|
|
|
-- Step 4: Drop old column
|
|
ALTER TABLE "sports_seasons" DROP COLUMN "is_draftable";
|