CREATE TYPE "public"."glazing" AS ENUM('Single glazing', 'Double glazing, 2002 or later', 'Double glazing, pre-2002', 'Triple glazing, pre-2002', 'Triple glazing, 2002 or later', 'Unknown');--> statement-breakpoint
ALTER TYPE "public"."override_component" ADD VALUE 'glazing';--> statement-breakpoint
CREATE TABLE "landlord_glazing_overrides" (
	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
	"portfolio_id" bigint NOT NULL,
	"description" text NOT NULL,
	"value" "glazing" 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_glazing_overrides_portfolio_description_unique" UNIQUE("portfolio_id","description")
);
--> statement-breakpoint
ALTER TABLE "landlord_glazing_overrides" ADD CONSTRAINT "landlord_glazing_overrides_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE cascade ON UPDATE no action;