- Add FIFA_48 bracket template with 12 groups of 4, knockout stage of 32 - Add tournament groups schema, model, and GroupStageDisplay component - Add projected/expected value scoring to standings and team breakdowns - Add docker-compose for local PostgreSQL development - Move DRAFT_ORDER_IMPLEMENTATION.md to plans directory Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
1.5 KiB
SQL
33 lines
1.5 KiB
SQL
CREATE TABLE IF NOT EXISTS "tournament_groups" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"scoring_event_id" uuid NOT NULL,
|
|
"group_name" varchar(10) NOT NULL,
|
|
"created_at" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE IF NOT EXISTS "tournament_group_members" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"tournament_group_id" uuid NOT NULL,
|
|
"participant_id" uuid NOT NULL,
|
|
"eliminated" boolean DEFAULT false NOT NULL,
|
|
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp DEFAULT now() NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
DO $$ BEGIN
|
|
ALTER TABLE "tournament_groups" ADD CONSTRAINT "tournament_groups_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 "tournament_group_members" ADD CONSTRAINT "tournament_group_members_tournament_group_id_tournament_groups_id_fk" FOREIGN KEY ("tournament_group_id") REFERENCES "public"."tournament_groups"("id") ON DELETE cascade ON UPDATE no action;
|
|
EXCEPTION
|
|
WHEN duplicate_object THEN null;
|
|
END $$;
|
|
--> statement-breakpoint
|
|
DO $$ BEGIN
|
|
ALTER TABLE "tournament_group_members" ADD CONSTRAINT "tournament_group_members_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 $$;
|