Add external model persistence foundation

This commit is contained in:
Julian Appel 2026-08-02 17:18:24 +02:00
parent d0fc1a7caf
commit 76493b573e
15 changed files with 3207 additions and 8 deletions

View 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
),
]
);