Remove project device mirror fields

This commit is contained in:
2026-07-23 20:55:26 +02:00
parent 3fbf3ac622
commit 30d6f1a2e1
10 changed files with 1588 additions and 20 deletions
@@ -0,0 +1,9 @@
ALTER TABLE `project_devices` DROP COLUMN `installed_power_per_unit_kw`;
--> statement-breakpoint
ALTER TABLE `project_devices` DROP COLUMN `demand_factor`;
--> statement-breakpoint
ALTER TABLE `project_devices` DROP COLUMN `phase_count`;
--> statement-breakpoint
ALTER TABLE `project_devices` DROP COLUMN `power_factor`;
--> statement-breakpoint
ALTER TABLE `project_devices` DROP COLUMN `note`;
File diff suppressed because it is too large Load Diff
+7
View File
@@ -78,6 +78,13 @@
"when": 1784746800000,
"tag": "0010_circuit_control_requirement",
"breakpoints": true
},
{
"idx": 11,
"version": "6",
"when": 1784832541202,
"tag": "0011_project_device_canonical_fields",
"breakpoints": true
}
]
}
@@ -37,12 +37,7 @@ export class ProjectDeviceRepository {
simultaneityFactor: input.simultaneityFactor,
cosPhi: input.cosPhi ?? null,
remark: input.remark ?? null,
installedPowerPerUnitKw: input.powerPerUnit,
demandFactor: input.simultaneityFactor,
voltageV: input.voltageV ?? null,
phaseCount: input.phaseType === "three_phase" ? 3 : 1,
powerFactor: input.cosPhi ?? null,
note: input.remark ?? null,
});
const created = await this.findById(projectId, id);
if (!created) {
@@ -77,12 +72,7 @@ export class ProjectDeviceRepository {
simultaneityFactor: input.simultaneityFactor,
cosPhi: input.cosPhi ?? null,
remark: input.remark ?? null,
installedPowerPerUnitKw: input.powerPerUnit,
demandFactor: input.simultaneityFactor,
voltageV: input.voltageV ?? null,
phaseCount: input.phaseType === "three_phase" ? 3 : 1,
powerFactor: input.cosPhi ?? null,
note: input.remark ?? null,
})
.where(
and(eq(projectDevices.id, projectDeviceId), eq(projectDevices.projectId, projectId))
-6
View File
@@ -17,11 +17,5 @@ export const projectDevices = sqliteTable("project_devices", {
simultaneityFactor: real("simultaneity_factor").notNull().default(1),
cosPhi: real("cos_phi"),
remark: text("remark"),
// Transitional mirror columns retained until a dedicated schema cleanup migration removes them.
installedPowerPerUnitKw: real("installed_power_per_unit_kw").notNull(),
demandFactor: real("demand_factor").notNull(),
voltageV: real("voltage_v"),
phaseCount: integer("phase_count"),
powerFactor: real("power_factor"),
note: text("note"),
});