Create clean release database baseline
This commit is contained in:
parent
5bee3cb103
commit
734a2bcfc4
129 changed files with 2121 additions and 30607 deletions
|
|
@ -11,7 +11,6 @@ export const circuitDeviceRows = sqliteTable("circuit_device_rows", {
|
|||
linkedProjectDeviceId: text("linked_project_device_id").references(() => projectDevices.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
legacyConsumerId: text("legacy_consumer_id"),
|
||||
sortOrder: integer("sort_order").notNull().default(0),
|
||||
name: text("name").notNull(),
|
||||
displayName: text("display_name").notNull(),
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ export const circuits = sqliteTable(
|
|||
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"),
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
import { integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
import { circuitLists } from "./circuit-lists.js";
|
||||
import { distributionBoards } from "./distribution-boards.js";
|
||||
import { projectDevices } from "./project-devices.js";
|
||||
import { projects } from "./projects.js";
|
||||
import { rooms } from "./rooms.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",
|
||||
}),
|
||||
circuitListId: text("circuit_list_id").references(() => circuitLists.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
projectDeviceId: text("project_device_id").references(() => projectDevices.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
isLinkedToDevice: integer("is_linked_to_device").notNull().default(0),
|
||||
roomId: text("room_id").references(() => rooms.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
circuitNumber: text("circuit_number"),
|
||||
description: text("description"),
|
||||
name: text("name").notNull(),
|
||||
category: text("category"),
|
||||
deviceType: text("device_type"),
|
||||
phaseType: text("phase_type"),
|
||||
tradeOrCostGroup: text("trade_or_cost_group"),
|
||||
group: text("group_name"),
|
||||
protectionType: text("protection_type"),
|
||||
protectionRatedCurrent: real("protection_rated_current"),
|
||||
protectionCharacteristic: text("protection_characteristic"),
|
||||
cableType: text("cable_type"),
|
||||
cableCrossSection: text("cable_cross_section"),
|
||||
comment: text("comment"),
|
||||
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"),
|
||||
});
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||||
import { circuitDeviceRows } from "./circuit-device-rows.js";
|
||||
import { circuitLists } from "./circuit-lists.js";
|
||||
import { circuits } from "./circuits.js";
|
||||
|
||||
export const legacyConsumerCircuitMigrations = sqliteTable("legacy_consumer_circuit_migrations", {
|
||||
consumerId: text("consumer_id").primaryKey(),
|
||||
circuitId: text("circuit_id")
|
||||
.notNull()
|
||||
.references(() => circuits.id, { onDelete: "cascade" }),
|
||||
circuitDeviceRowId: text("circuit_device_row_id")
|
||||
.notNull()
|
||||
.references(() => circuitDeviceRows.id, { onDelete: "cascade" }),
|
||||
circuitListId: text("circuit_list_id")
|
||||
.notNull()
|
||||
.references(() => circuitLists.id, { onDelete: "cascade" }),
|
||||
createdAtIso: text("created_at_iso").notNull(),
|
||||
});
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import { integer, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
|
||||
import { circuitLists } from "./circuit-lists.js";
|
||||
|
||||
export const legacyConsumerMigrationReports = sqliteTable(
|
||||
"legacy_consumer_migration_reports",
|
||||
{
|
||||
id: text("id").primaryKey(),
|
||||
circuitListId: text("circuit_list_id")
|
||||
.notNull()
|
||||
.references(() => circuitLists.id, { onDelete: "cascade" }),
|
||||
legacyConsumerCount: integer("legacy_consumer_count").notNull(),
|
||||
createdCircuitCount: integer("created_circuit_count").notNull(),
|
||||
createdDeviceRowCount: integer("created_device_row_count").notNull(),
|
||||
duplicateGroupedCount: integer("duplicate_grouped_count").notNull(),
|
||||
generatedIdentifierCount: integer("generated_identifier_count").notNull(),
|
||||
unassignedRowCount: integer("unassigned_row_count").notNull(),
|
||||
warningsJson: text("warnings_json").notNull(),
|
||||
generatedIdentifiersJson: text("generated_identifiers_json").notNull(),
|
||||
duplicateGroupsJson: text("duplicate_groups_json").notNull(),
|
||||
createdAtIso: text("created_at_iso").notNull(),
|
||||
},
|
||||
(table) => [unique("legacy_consumer_migration_reports_list_unique").on(table.circuitListId)]
|
||||
);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue