funding migrations

This commit is contained in:
Khalim Conn-Kowlessar 2025-08-21 17:44:37 +00:00
parent c85d3956ce
commit 11d1605d5e
9 changed files with 10127 additions and 2 deletions

View file

@ -0,0 +1,2 @@
CREATE TYPE "public"."scheme" AS ENUM('eco4', 'gbis', 'whlg', 'none');--> statement-breakpoint
ALTER TABLE "funding_package" ALTER COLUMN "scheme" SET DATA TYPE "public"."scheme" USING "scheme"::text::"public"."scheme";

View file

@ -0,0 +1 @@
ALTER TABLE "funding_package_measures" RENAME COLUMN "type" TO "measure";

View file

@ -0,0 +1 @@
ALTER TYPE "public"."type" ADD VALUE 'air_source_heat_pump' BEFORE 'sealing_fireplace';

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -778,6 +778,27 @@
"when": 1755789401931,
"tag": "0110_colossal_hulk",
"breakpoints": true
},
{
"idx": 111,
"version": "7",
"when": 1755794600885,
"tag": "0111_eminent_red_wolf",
"breakpoints": true
},
{
"idx": 112,
"version": "7",
"when": 1755795339728,
"tag": "0112_colossal_nightshade",
"breakpoints": true
},
{
"idx": 113,
"version": "7",
"when": 1755798209029,
"tag": "0113_bright_lady_bullseye",
"breakpoints": true
}
]
}

View file

@ -12,7 +12,7 @@ import { material, materialTypeEnum } from "./materials"
export const SchemeEnum: [string, ...string[]] = ["eco4", "gbis", "whlg", "none"];
export const Scheme = pgEnum("depth_unit", SchemeEnum);
export const Scheme = pgEnum("scheme", SchemeEnum);
// funding package table which has the aggregate level data for the funding package. A funding package will be
// tied to a plan
@ -35,7 +35,7 @@ export const fundingPackageMeasures = pgTable("funding_package_measures", {
fundingPackageId: bigint("funding_package_id", { mode: "bigint" })
.notNull()
.references(() => fundingPackage.id),
measure: materialTypeEnum("type").notNull(),
measure: materialTypeEnum("measure").notNull(),
materialId: bigint("material_id", { mode: "bigint" })
.references(() => material.id), // May be null initially
innovationUplift: real("innovation_uplift"),

View file

@ -52,6 +52,7 @@ export const MaterialType: [string, ...string[]] = [
"scaffolding",
// heating systems
"high_heat_retention_storage_heaters",
"air_source_heat_pump",
// other
"sealing_fireplace"
];