assessment-model/src/app/db/migrations/0207_flat_white_queen.sql
2026-05-26 15:04:02 +00:00

13 lines
No EOL
959 B
SQL

CREATE TYPE "public"."built_form_type" AS ENUM('Detached', 'Semi-Detached', 'Mid-Terrace', 'End-Terrace', 'Enclosed Mid-Terrace', 'Enclosed End-Terrace', 'Not Recorded', 'Unknown');--> statement-breakpoint
CREATE TABLE "landlord_built_form_type_overrides" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"portfolio_id" bigint NOT NULL,
"description" text NOT NULL,
"value" "built_form_type" NOT NULL,
"source" "override_source" NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "landlord_built_form_type_overrides_portfolio_description_unique" UNIQUE("portfolio_id","description")
);
--> statement-breakpoint
ALTER TABLE "landlord_built_form_type_overrides" ADD CONSTRAINT "landlord_built_form_type_overrides_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE cascade ON UPDATE no action;