mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
making uprn unique on epc store
This commit is contained in:
parent
53858c2e3b
commit
3e90bee22a
4 changed files with 4893 additions and 14 deletions
1
src/app/db/migrations/0139_skinny_legion.sql
Normal file
1
src/app/db/migrations/0139_skinny_legion.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
CREATE UNIQUE INDEX "uq_epc_store_uprn" ON "epc_store" USING btree ("uprn");
|
||||
4866
src/app/db/migrations/meta/0139_snapshot.json
Normal file
4866
src/app/db/migrations/meta/0139_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -974,6 +974,13 @@
|
|||
"when": 1766319125106,
|
||||
"tag": "0138_neat_havok",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 139,
|
||||
"version": "7",
|
||||
"when": 1766321608808,
|
||||
"tag": "0139_skinny_legion",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import {
|
|||
jsonb,
|
||||
timestamp,
|
||||
bigint,
|
||||
uniqueIndex,
|
||||
} from "drizzle-orm/pg-core";
|
||||
|
||||
// This table stores postcode search results from the OS Places API
|
||||
|
|
@ -23,22 +24,26 @@ export interface EpcApiResponse {
|
|||
rows?: Record<string, any>;
|
||||
}
|
||||
|
||||
export const epcStore = pgTable("epc_store", {
|
||||
id: serial("id").primaryKey(),
|
||||
uprn: bigint("uprn", { mode: "bigint" }),
|
||||
export const epcStore = pgTable(
|
||||
"epc_store",
|
||||
{
|
||||
id: serial("id").primaryKey(),
|
||||
uprn: bigint("uprn", { mode: "bigint" }),
|
||||
|
||||
// Timestamp for when the EPC API entry was first stored
|
||||
epcApiCreatedAt: timestamp("epc_api_created_at"),
|
||||
// Timestamp for when the EPC API entry was first stored
|
||||
epcApiCreatedAt: timestamp("epc_api_created_at"),
|
||||
|
||||
// EPC API response for the UPRN
|
||||
epcApi: jsonb("epc_api").$type<EpcApiResponse>(),
|
||||
// EPC API response for the UPRN
|
||||
epcApi: jsonb("epc_api").$type<EpcApiResponse>(),
|
||||
|
||||
// Timestamp for when the EPC page was stored
|
||||
epcPageCreatedAt: timestamp("epc_page_created_at"),
|
||||
// Timestamp for when the EPC page was stored
|
||||
epcPageCreatedAt: timestamp("epc_page_created_at"),
|
||||
|
||||
// HTML content of the EPC page
|
||||
epcPage: text("epc_page"),
|
||||
// HTML content of the EPC page
|
||||
epcPage: text("epc_page"),
|
||||
|
||||
// RRN of the EPC page
|
||||
epcPageRrn: text("epc_page_rrn"),
|
||||
});
|
||||
// RRN of the EPC page
|
||||
epcPageRrn: text("epc_page_rrn"),
|
||||
},
|
||||
(table) => [uniqueIndex("uq_epc_store_uprn").on(table.uprn)]
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue