CREATE TABLE "magic_plan_door_ventilation" (
	"id" bigserial PRIMARY KEY NOT NULL,
	"magic_plan_door_id" bigint NOT NULL,
	"undercut_mm" real,
	CONSTRAINT "magic_plan_door_ventilation_magic_plan_door_id_unique" UNIQUE("magic_plan_door_id")
);
--> statement-breakpoint
CREATE TABLE "magic_plan_window_ventilation" (
	"id" bigserial PRIMARY KEY NOT NULL,
	"magic_plan_window_id" bigint NOT NULL,
	"opening_type" text,
	"num_openings" integer,
	"pct_openable" integer,
	"trickle_vent_area_mm2" integer,
	"num_trickle_vents" integer,
	CONSTRAINT "magic_plan_window_ventilation_magic_plan_window_id_unique" UNIQUE("magic_plan_window_id")
);
--> statement-breakpoint
ALTER TABLE "magic_plan_door" ADD COLUMN "height_mm" real;--> statement-breakpoint
ALTER TABLE "magic_plan_door_ventilation" ADD CONSTRAINT "magic_plan_door_ventilation_magic_plan_door_id_magic_plan_door_id_fk" FOREIGN KEY ("magic_plan_door_id") REFERENCES "public"."magic_plan_door"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "magic_plan_window_ventilation" ADD CONSTRAINT "magic_plan_window_ventilation_magic_plan_window_id_magic_plan_window_id_fk" FOREIGN KEY ("magic_plan_window_id") REFERENCES "public"."magic_plan_window"("id") ON DELETE cascade ON UPDATE no action;