Phase 1A done
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { integer, real, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
|
||||
import { circuitLists } from "./circuit-lists.js";
|
||||
import { circuitSections } from "./circuit-sections.js";
|
||||
|
||||
export const circuits = sqliteTable(
|
||||
"circuits",
|
||||
{
|
||||
id: text("id").primaryKey(),
|
||||
circuitListId: text("circuit_list_id")
|
||||
.notNull()
|
||||
.references(() => circuitLists.id, { onDelete: "cascade" }),
|
||||
sectionId: text("section_id")
|
||||
.notNull()
|
||||
.references(() => circuitSections.id, { onDelete: "cascade" }),
|
||||
equipmentIdentifier: text("equipment_identifier").notNull(),
|
||||
displayName: text("display_name"),
|
||||
sortOrder: integer("sort_order").notNull().default(0),
|
||||
protectionType: text("protection_type"),
|
||||
protectionRatedCurrent: real("protection_rated_current"),
|
||||
protectionCharacteristic: text("protection_characteristic"),
|
||||
cableType: text("cable_type"),
|
||||
cableCrossSection: text("cable_cross_section"),
|
||||
cableLength: real("cable_length"),
|
||||
rcdAssignment: text("rcd_assignment"),
|
||||
terminalDesignation: text("terminal_designation"),
|
||||
voltage: real("voltage"),
|
||||
status: text("status"),
|
||||
isReserve: integer("is_reserve").notNull().default(0),
|
||||
remark: text("remark"),
|
||||
},
|
||||
(table) => [unique("circuits_list_equipment_identifier_unique").on(table.circuitListId, table.equipmentIdentifier)]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user