24 lines
596 B
TypeScript
Raw Normal View History

2024-04-16 18:19:34 -04:00
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),
});