24 lines
596 B
TypeScript
24 lines
596 B
TypeScript
|
import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
||
|
import { createId } from "@paralleldrive/cuid2";
|
||
|
|
||
|
export const user = sqliteTable("user", {
|
||
|
id: text("id")
|
||
|
.$defaultFn(() => createId())
|
||
|
.primaryKey()
|
||
|
.unique(),
|
||
|
name: text("name").notNull(),
|
||
|
email: text("email").notNull(),
|
||
|
});
|
||
|
|
||
|
export const sandbox = sqliteTable("sandbox", {
|
||
|
id: text("id")
|
||
|
.$defaultFn(() => createId())
|
||
|
.primaryKey()
|
||
|
.unique(),
|
||
|
name: text("name").notNull(),
|
||
|
type: text("text", { enum: ["react", "node"] }).notNull(),
|
||
|
userId: text("user_id")
|
||
|
.notNull()
|
||
|
.references(() => user.id),
|
||
|
});
|