forked from jappel/leistungsbilanz-ts
22 lines
777 B
TypeScript
22 lines
777 B
TypeScript
import { integer, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core";
|
|
import type { ExternalCsvConfiguration } from "../../external-model/csv/external-csv-contracts.js";
|
|
import { projects } from "./projects.js";
|
|
|
|
export const externalCsvConfigurations = sqliteTable(
|
|
"external_csv_configurations",
|
|
{
|
|
id: text("id").primaryKey(),
|
|
projectId: text("project_id")
|
|
.notNull()
|
|
.references(() => projects.id, { onDelete: "cascade" }),
|
|
configurationVersion: integer("configuration_version").notNull(),
|
|
configuration: text("configuration", { mode: "json" })
|
|
.$type<ExternalCsvConfiguration>()
|
|
.notNull(),
|
|
},
|
|
(table) => [
|
|
uniqueIndex("external_csv_configurations_project_id_unique").on(
|
|
table.projectId
|
|
),
|
|
]
|
|
);
|