mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
Merge pull request #328 from Hestia-Homes/feature/mark_for_deletion
feat(db): add property.marked_for_deletion migration
This commit is contained in:
commit
165858b387
4 changed files with 11519 additions and 0 deletions
1
src/app/db/migrations/0244_unknown_puck.sql
Normal file
1
src/app/db/migrations/0244_unknown_puck.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE "property" ADD COLUMN "marked_for_deletion" boolean DEFAULT false NOT NULL;
|
||||
11505
src/app/db/migrations/meta/0244_snapshot.json
Normal file
11505
src/app/db/migrations/meta/0244_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1702,6 +1702,13 @@
|
|||
"when": 1782313328071,
|
||||
"tag": "0243_oval_pestilence",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 244,
|
||||
"version": "7",
|
||||
"when": 1782387040698,
|
||||
"tag": "0244_unknown_puck",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -155,6 +155,12 @@ export const property = pgTable(
|
|||
// lodged data
|
||||
lodgedSapPoints: real("lodged_sap_points"),
|
||||
lodgedEpcRating: epcEnum("lodged_epc_rating"),
|
||||
|
||||
// Soft-delete marker. Hard deletes on `property` are expensive (cascading
|
||||
// child rows, indexes), so callers flag a row here and reads filter it out;
|
||||
// a separate cron job performs the physical delete later. NOT NULL so reads
|
||||
// never deal with a tri-state — every live row is explicitly `false`.
|
||||
markedForDeletion: boolean("marked_for_deletion").notNull().default(false),
|
||||
},
|
||||
(table) => [
|
||||
uniqueIndex("uq_property_portfolio_uprn")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue