Preserve original migration tags and SQL to match production hashes
Restores the original tag name (0068_cs2_major_simulator) and exact SQL content for migrations 0068 and 0069 so their hashes match what's already recorded in the production __drizzle_migrations table. Also fixes the snapshot id/prevId chain to use consistent tag-based identifiers. https://claude.ai/code/session_01JuVHpRPa974MKSHoXNGkgU
This commit is contained in:
parent
4982fe07df
commit
d7e1c380a6
6 changed files with 22 additions and 21 deletions
|
|
@ -23,4 +23,4 @@ EXCEPTION
|
|||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "cs2_major_stage_results_unique" ON "cs2_major_stage_results" USING btree ("scoring_event_id","participant_id");
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "cs2_major_stage_results_unique" ON "cs2_major_stage_results" USING btree ("scoring_event_id","participant_id");
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
-- Step 1: Add new columns as nullable (IF NOT EXISTS for idempotency)
|
||||
ALTER TABLE "sports_seasons" ADD COLUMN IF NOT EXISTS "draft_on" date;--> statement-breakpoint
|
||||
ALTER TABLE "sports_seasons" ADD COLUMN IF NOT EXISTS "draft_off" date;--> statement-breakpoint
|
||||
-- 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 (only if column still exists)
|
||||
DO $$ BEGIN
|
||||
IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name = 'sports_seasons' AND column_name = 'is_draftable') THEN
|
||||
UPDATE "sports_seasons" SET "draft_on" = '2026-04-06', "draft_off" = '2099-12-31' WHERE "is_draftable" = true;
|
||||
UPDATE "sports_seasons" SET "draft_on" = '2020-01-01', "draft_off" = '2020-12-31' WHERE "is_draftable" = false;
|
||||
END IF;
|
||||
END $$;--> 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 (IF EXISTS for idempotency)
|
||||
ALTER TABLE "sports_seasons" DROP COLUMN IF EXISTS "is_draftable";
|
||||
-- Step 4: Drop old column
|
||||
ALTER TABLE "sports_seasons" DROP COLUMN "is_draftable";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"id": "36896379-5f24-4c5a-9920-b5bb96f34b8e",
|
||||
"id": "0068_cs2_major_simulator",
|
||||
"prevId": "0067_darts_bracket",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
|
|
@ -4462,4 +4462,4 @@
|
|||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "05dcbcde-8087-46f0-81da-99299a36e2e9",
|
||||
"prevId": "36896379-5f24-4c5a-9920-b5bb96f34b8e",
|
||||
"id": "0069_draft_window",
|
||||
"prevId": "0068_cs2_major_simulator",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"tables": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"id": "6949c47a-4107-4053-b87a-f7fbc6560dd5",
|
||||
"prevId": "05dcbcde-8087-46f0-81da-99299a36e2e9",
|
||||
"id": "0070_verify_migrations",
|
||||
"prevId": "0069_draft_window",
|
||||
"version": "7",
|
||||
"dialect": "postgresql",
|
||||
"tables": {
|
||||
|
|
@ -4467,4 +4467,4 @@
|
|||
"schemas": {},
|
||||
"tables": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@
|
|||
"idx": 68,
|
||||
"version": "7",
|
||||
"when": 1775485575205,
|
||||
"tag": "0068_soft_silk_fever",
|
||||
"tag": "0068_cs2_major_simulator",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue