first commit

This commit is contained in:
2026-04-30 18:22:10 +02:00
commit c3e98af5b6
36 changed files with 4779 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import { integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
import { distributionBoards } from "./distribution-boards.js";
import { projects } from "./projects.js";
export const consumers = sqliteTable("consumers", {
id: text("id").primaryKey(),
projectId: text("project_id")
.notNull()
.references(() => projects.id, { onDelete: "cascade" }),
distributionBoardId: text("distribution_board_id").references(() => distributionBoards.id, {
onDelete: "set null",
}),
name: text("name").notNull(),
category: text("category"),
quantity: integer("quantity").notNull(),
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"),
});