CREATE TYPE "public"."autodraft_mode" AS ENUM('next_pick', 'while_on');--> statement-breakpoint CREATE TABLE IF NOT EXISTS "autodraft_settings" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "season_id" uuid NOT NULL, "team_id" uuid NOT NULL, "is_enabled" boolean DEFAULT false NOT NULL, "mode" "autodraft_mode" DEFAULT 'next_pick' NOT NULL, "created_at" timestamp DEFAULT now() NOT NULL, "updated_at" timestamp DEFAULT now() NOT NULL ); --> statement-breakpoint DO $$ BEGIN ALTER TABLE "autodraft_settings" ADD CONSTRAINT "autodraft_settings_season_id_seasons_id_fk" FOREIGN KEY ("season_id") REFERENCES "public"."seasons"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$; --> statement-breakpoint DO $$ BEGIN ALTER TABLE "autodraft_settings" ADD CONSTRAINT "autodraft_settings_team_id_teams_id_fk" FOREIGN KEY ("team_id") REFERENCES "public"."teams"("id") ON DELETE cascade ON UPDATE no action; EXCEPTION WHEN duplicate_object THEN null; END $$;