feat(id): brand ProjectID through Drizzle and Zod schemas (#16948)
This commit is contained in:
parent
c37f7b9d99
commit
dbc00aa8e0
15 changed files with 77 additions and 44 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import { sqliteTable, text } from "drizzle-orm/sqlite-core"
|
||||
import { ProjectTable } from "../project/project.sql"
|
||||
import type { ProjectID } from "../project/schema"
|
||||
|
||||
export const WorkspaceTable = sqliteTable("workspace", {
|
||||
id: text().primaryKey(),
|
||||
|
|
@ -9,6 +10,7 @@ export const WorkspaceTable = sqliteTable("workspace", {
|
|||
directory: text(),
|
||||
extra: text({ mode: "json" }),
|
||||
project_id: text()
|
||||
.$type<ProjectID>()
|
||||
.notNull()
|
||||
.references(() => ProjectTable.id, { onDelete: "cascade" }),
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue