2026-02-27 20:36:39 +00:00
|
|
|
import { sqliteTable, text } from "drizzle-orm/sqlite-core"
|
2026-03-10 16:53:47 +00:00
|
|
|
import { ProjectTable } from "../project/project.sql"
|
2026-03-11 20:44:26 +00:00
|
|
|
import type { ProjectID } from "../project/schema"
|
2026-03-11 23:30:17 +00:00
|
|
|
import type { WorkspaceID } from "./schema"
|
2026-02-27 20:36:39 +00:00
|
|
|
|
|
|
|
|
export const WorkspaceTable = sqliteTable("workspace", {
|
2026-03-11 23:30:17 +00:00
|
|
|
id: text().$type<WorkspaceID>().primaryKey(),
|
2026-03-04 02:35:38 +00:00
|
|
|
type: text().notNull(),
|
2026-02-27 20:36:39 +00:00
|
|
|
branch: text(),
|
2026-03-04 02:35:38 +00:00
|
|
|
name: text(),
|
|
|
|
|
directory: text(),
|
|
|
|
|
extra: text({ mode: "json" }),
|
2026-02-27 20:36:39 +00:00
|
|
|
project_id: text()
|
2026-03-11 20:44:26 +00:00
|
|
|
.$type<ProjectID>()
|
2026-02-27 20:36:39 +00:00
|
|
|
.notNull()
|
|
|
|
|
.references(() => ProjectTable.id, { onDelete: "cascade" }),
|
|
|
|
|
})
|