CREATE TABLE IF NOT EXISTS "property_targets" (
	"id" serial PRIMARY KEY NOT NULL,
	"property_id" integer NOT NULL,
	"portfolio_id" integer NOT NULL,
	"created_at" timestamp NOT NULL,
	"epc" "epc",
	"heat_demand" text
);
--> statement-breakpoint
DO $$ BEGIN
 ALTER TABLE "property_targets" ADD CONSTRAINT "property_targets_property_id_property_id_fk" FOREIGN KEY ("property_id") REFERENCES "property"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;
--> statement-breakpoint
DO $$ BEGIN
 ALTER TABLE "property_targets" ADD CONSTRAINT "property_targets_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "portfolio"("id") ON DELETE no action ON UPDATE no action;
EXCEPTION
 WHEN duplicate_object THEN null;
END $$;
