This commit is contained in:
Frank
2025-09-29 14:17:53 -04:00
parent 5345c828ca
commit 7447460b5a
24 changed files with 995 additions and 242 deletions

View File

@@ -2,8 +2,7 @@ import { mysqlTable, uniqueIndex, varchar, int, mysqlEnum } from "drizzle-orm/my
import { timestamps, utc, workspaceColumns } from "../drizzle/types"
import { workspaceIndexes } from "./workspace.sql"
const UserRole = ["admin", "member"] as const
export type UserRole = (typeof UserRole)[number]
export const UserRole = ["admin", "member"] as const
export const UserTable = mysqlTable(
"user",
@@ -13,9 +12,8 @@ export const UserTable = mysqlTable(
email: varchar("email", { length: 255 }).notNull(),
name: varchar("name", { length: 255 }).notNull(),
timeSeen: utc("time_seen"),
timeJoined: utc("time_joined"),
color: int("color"),
role: mysqlEnum("role", ["admin", "member"]).notNull(),
role: mysqlEnum("role", UserRole).notNull(),
},
(table) => [...workspaceIndexes(table), uniqueIndex("user_email").on(table.workspaceID, table.email)],
)