Add external model persistence foundation
This commit is contained in:
parent
d0fc1a7caf
commit
76493b573e
15 changed files with 3207 additions and 8 deletions
23
src/db/schema/external-model-sources.ts
Normal file
23
src/db/schema/external-model-sources.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core";
|
||||
import { externalModelSourceTypes } from "../../external-model/domain/external-model-contracts.js";
|
||||
import { projects } from "./projects.js";
|
||||
|
||||
export const externalModelSources = sqliteTable(
|
||||
"external_model_sources",
|
||||
{
|
||||
id: text("id").primaryKey(),
|
||||
projectId: text("project_id")
|
||||
.notNull()
|
||||
.references(() => projects.id, { onDelete: "cascade" }),
|
||||
name: text("name").notNull(),
|
||||
sourceType: text("source_type", { enum: externalModelSourceTypes })
|
||||
.notNull()
|
||||
.default("revit_csv"),
|
||||
},
|
||||
(table) => [
|
||||
uniqueIndex("external_model_sources_project_type_unique").on(
|
||||
table.projectId,
|
||||
table.sourceType
|
||||
),
|
||||
]
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue