24 lines
699 B
TypeScript
24 lines
699 B
TypeScript
import { integer, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
|
|
import { projects } from "./projects.js";
|
|
|
|
export const projectRevisions = sqliteTable(
|
|
"project_revisions",
|
|
{
|
|
id: text("id").primaryKey(),
|
|
projectId: text("project_id")
|
|
.notNull()
|
|
.references(() => projects.id, { onDelete: "cascade" }),
|
|
revisionNumber: integer("revision_number").notNull(),
|
|
createdAtIso: text("created_at_iso").notNull(),
|
|
actorId: text("actor_id"),
|
|
source: text("source").notNull(),
|
|
description: text("description"),
|
|
},
|
|
(table) => [
|
|
unique("project_revisions_project_number_unique").on(
|
|
table.projectId,
|
|
table.revisionNumber
|
|
),
|
|
]
|
|
);
|