From e5a00d4454b5abfdd1f2f9bb4c611289479a1135 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 4 Sep 2024 11:15:12 +0100 Subject: [PATCH] adding fields to energy assessment document --- src/app/db/schema/energy_assessments.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/app/db/schema/energy_assessments.ts b/src/app/db/schema/energy_assessments.ts index fdaad620..a6816e5d 100644 --- a/src/app/db/schema/energy_assessments.ts +++ b/src/app/db/schema/energy_assessments.ts @@ -148,6 +148,7 @@ export const DocumentType: [string, ...string[]] = [ "Evidence Report", "Summary Information", "Floor Plan", + "Scenario EPR", ]; export const DocumentTypeEnum = pgEnum("document_type", DocumentType); @@ -156,11 +157,19 @@ export const energyAssessmentDocuments = pgTable( "energy_assessment_documents", { id: bigserial("id", { mode: "bigint" }).primaryKey(), + uprn: bigint("uprn", { mode: "bigint" }).notNull(), energyAssessmentId: bigint("energy_assessment_id", { mode: "bigint", }).notNull(), documentType: DocumentTypeEnum("document_type").notNull(), documentLocation: text("document_location").notNull(), + // The uploaded at date is automatically created when a new record is added + uploadedAt: timestamp("uploaded_at", { + precision: 6, + withTimezone: true, + }) + .notNull() + .defaultNow(), } );