CREATE TABLE "deal_slug_redirects" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"deal_id" uuid NOT NULL,
	"locale" text NOT NULL,
	"old_slug" text NOT NULL,
	"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "deal_translations" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"deal_id" uuid NOT NULL,
	"locale" text NOT NULL,
	"slug" text NOT NULL,
	"title" text NOT NULL,
	"description" text DEFAULT '' NOT NULL,
	"special_instructions" text,
	"pickup_address" text DEFAULT '' NOT NULL,
	"title_manual_override" boolean DEFAULT false NOT NULL,
	"description_manual_override" boolean DEFAULT false NOT NULL,
	"special_instructions_manual_override" boolean DEFAULT false NOT NULL,
	"search" text,
	"model_id" text,
	"status" text DEFAULT 'OK' NOT NULL,
	"translated_at" timestamp with time zone,
	"created_at" timestamp with time zone DEFAULT now() NOT NULL,
	"updated_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "deal_slug_redirects" ADD CONSTRAINT "deal_slug_redirects_deal_id_deals_id_fk" FOREIGN KEY ("deal_id") REFERENCES "public"."deals"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "deal_slug_redirects" ADD CONSTRAINT "deal_slug_redirects_locale_languages_code_fk" FOREIGN KEY ("locale") REFERENCES "public"."languages"("code") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "deal_translations" ADD CONSTRAINT "deal_translations_deal_id_deals_id_fk" FOREIGN KEY ("deal_id") REFERENCES "public"."deals"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "deal_translations" ADD CONSTRAINT "deal_translations_locale_languages_code_fk" FOREIGN KEY ("locale") REFERENCES "public"."languages"("code") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE UNIQUE INDEX "deal_slug_redirects_locale_old_idx" ON "deal_slug_redirects" USING btree ("locale","old_slug");--> statement-breakpoint
CREATE INDEX "deal_slug_redirects_deal_idx" ON "deal_slug_redirects" USING btree ("deal_id");--> statement-breakpoint
CREATE UNIQUE INDEX "deal_translations_deal_locale_idx" ON "deal_translations" USING btree ("deal_id","locale");--> statement-breakpoint
CREATE UNIQUE INDEX "deal_translations_locale_slug_idx" ON "deal_translations" USING btree ("locale","slug");--> statement-breakpoint
CREATE INDEX "deal_translations_locale_status_idx" ON "deal_translations" USING btree ("locale","status");