28 lines
920 B
TypeScript
28 lines
920 B
TypeScript
import { real, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
import type {
|
|
BreakerTripCharacteristic,
|
|
FuseUtilizationCategory,
|
|
ProtectionDeviceType,
|
|
RcdType,
|
|
} from "../../shared/constants/protection-device.js";
|
|
import { circuits } from "./circuits.js";
|
|
|
|
export const circuitProtectionDevices = sqliteTable(
|
|
"circuit_protection_devices",
|
|
{
|
|
circuitId: text("circuit_id")
|
|
.primaryKey()
|
|
.references(() => circuits.id, { onDelete: "cascade" }),
|
|
type: text("type").$type<ProtectionDeviceType>().notNull(),
|
|
ratedCurrentA: real("rated_current_a").notNull(),
|
|
fuseUtilizationCategory: text(
|
|
"fuse_utilization_category"
|
|
).$type<FuseUtilizationCategory>(),
|
|
tripCharacteristic: text(
|
|
"trip_characteristic"
|
|
).$type<BreakerTripCharacteristic>(),
|
|
rcdType: text("rcd_type").$type<RcdType>(),
|
|
ratedResidualCurrentMa: real("rated_residual_current_ma"),
|
|
}
|
|
);
|