brackt/drizzle/0068_cs2_major_simulator.sql
Claude d7e1c380a6
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
2026-04-06 14:44:29 +00:00

26 lines
1.3 KiB
SQL

ALTER TYPE "public"."simulator_type" ADD VALUE 'cs2_major_qualifying_points';--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "cs2_major_stage_results" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"scoring_event_id" uuid NOT NULL,
"participant_id" uuid NOT NULL,
"stage_entry" integer NOT NULL,
"stage_eliminated" integer,
"stage_eliminated_wins" integer,
"final_placement" integer,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "cs2_major_stage_results" ADD CONSTRAINT "cs2_major_stage_results_scoring_event_id_scoring_events_id_fk" FOREIGN KEY ("scoring_event_id") REFERENCES "public"."scoring_events"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "cs2_major_stage_results" ADD CONSTRAINT "cs2_major_stage_results_participant_id_participants_id_fk" FOREIGN KEY ("participant_id") REFERENCES "public"."participants"("id") ON DELETE cascade ON UPDATE no action;
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");