Merge pull request #246 from Hestia-Homes/feature/new-epc-tables

Add uploaded_file_id fk column to epc_property table
This commit is contained in:
Daniel Roth 2026-04-28 17:12:40 +01:00 committed by GitHub
commit 765ef62b57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 17299 additions and 0 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE "epc_property" ADD COLUMN "uploaded_file_id" bigint;--> statement-breakpoint
ALTER TABLE "epc_property" ADD CONSTRAINT "epc_property_uploaded_file_id_uploaded_files_id_fk" FOREIGN KEY ("uploaded_file_id") REFERENCES "public"."uploaded_files"("id") ON DELETE no action ON UPDATE no action;

View file

@ -0,0 +1 @@
ALTER TABLE "epc_property" ADD CONSTRAINT "epc_property_uploaded_file_id_unique" UNIQUE("uploaded_file_id");

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1324,6 +1324,20 @@
"when": 1777364161220,
"tag": "0188_wild_morph",
"breakpoints": true
},
{
"idx": 189,
"version": "7",
"when": 1777392468614,
"tag": "0189_high_leech",
"breakpoints": true
},
{
"idx": 190,
"version": "7",
"when": 1777392681924,
"tag": "0190_worried_drax",
"breakpoints": true
}
]
}

View file

@ -15,6 +15,7 @@ import { portfolio, PortfolioStatus } from "./portfolio";
import { InferModel } from "drizzle-orm";
import { materialTypeEnum } from "./materials";
import { sql } from "drizzle-orm";
import { uploadedFiles } from "./uploaded_files";
// This is a placeholder for the property schema
export interface PropertyMeta {
@ -421,6 +422,9 @@ export const epcProperty = pgTable(
portfolioId: bigint("portfolio_id", { mode: "bigint" })
// .notNull()
.references(() => portfolio.id),
uploadedFileId: bigint("uploaded_file_id", { mode: "bigint" })
.unique()
.references(() => uploadedFiles.id),
// Identity / admin
uprn: bigint("uprn", { mode: "bigint" }),