mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
Merge pull request #294 from Hestia-Homes/db/landlord-override-migrations
Add landlord-override DB migrations (0215 data + 0216 schema)
This commit is contained in:
commit
49d3edc6cd
6 changed files with 20297 additions and 0 deletions
22
src/app/db/migrations/0215_invert_column_mapping.sql
Normal file
22
src/app/db/migrations/0215_invert_column_mapping.sql
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- One-shot inversion of bulk_address_uploads.column_mapping.
|
||||
--
|
||||
-- Old shape: { "<source header>": "<internal field>" } (header -> field), with
|
||||
-- unmapped columns stored as "<header>": "skip".
|
||||
-- New shape: { "<internal field>": "<source header>" } (field -> header), with
|
||||
-- unmapped fields simply absent. See ADR-0003 and the WIP plan (Q2.2/Q5).
|
||||
--
|
||||
-- 'skip' entries are dropped. On a legacy duplicate (two headers -> one field),
|
||||
-- jsonb_object_agg keeps the last header — the new address-uniqueness rule
|
||||
-- forbids that going forward anyway. No-op on NULL/empty mappings, so this is
|
||||
-- safe regardless of data volume. One-shot: assumes rows are still old-shape.
|
||||
UPDATE "bulk_address_uploads"
|
||||
SET "column_mapping" = COALESCE(
|
||||
(
|
||||
SELECT jsonb_object_agg(elem.value, elem.key)
|
||||
FROM jsonb_each_text("column_mapping") AS elem
|
||||
WHERE elem.value <> 'skip'
|
||||
),
|
||||
'{}'::jsonb
|
||||
)
|
||||
WHERE "column_mapping" IS NOT NULL
|
||||
AND "column_mapping" <> '{}'::jsonb;
|
||||
1
src/app/db/migrations/0216_add_subtask_service.sql
Normal file
1
src/app/db/migrations/0216_add_subtask_service.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE "sub_task" ADD COLUMN "service" text;
|
||||
10125
src/app/db/migrations/meta/0215_snapshot.json
Normal file
10125
src/app/db/migrations/meta/0215_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
10131
src/app/db/migrations/meta/0216_snapshot.json
Normal file
10131
src/app/db/migrations/meta/0216_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1506,6 +1506,20 @@
|
|||
"when": 1779969672088,
|
||||
"tag": "0214_superb_maelstrom",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 215,
|
||||
"version": "7",
|
||||
"when": 1779991310301,
|
||||
"tag": "0215_invert_column_mapping",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 216,
|
||||
"version": "7",
|
||||
"when": 1779992128370,
|
||||
"tag": "0216_add_subtask_service",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -14,6 +14,10 @@ export const subTasks = pgTable("sub_task", {
|
|||
|
||||
status: text("status").notNull().default("In Progress"),
|
||||
|
||||
// Which pipeline this subtask belongs to, e.g. "address2uprn" or
|
||||
// "landlord_description_overrides". NULL = legacy / address. See ADR-0003.
|
||||
service: text("service"),
|
||||
|
||||
inputs: text("inputs"), // could later change to JSONB if desired
|
||||
outputs: text("outputs"),
|
||||
cloudLogsURL: text("cloud_logs_url"),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue