mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-02 06:20:29 +00:00
wip: zen
This commit is contained in:
parent
ae15c91455
commit
a45fa7a93c
13 changed files with 948 additions and 133 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { mysqlTable, uniqueIndex, varchar, int, mysqlEnum } from "drizzle-orm/mysql-core"
|
||||
import { timestamps, utc, workspaceColumns } from "../drizzle/types"
|
||||
import { timestamps, ulid, utc, workspaceColumns } from "../drizzle/types"
|
||||
import { workspaceIndexes } from "./workspace.sql"
|
||||
|
||||
export const UserRole = ["admin", "member"] as const
|
||||
|
|
@ -9,6 +9,8 @@ export const UserTable = mysqlTable(
|
|||
{
|
||||
...workspaceColumns,
|
||||
...timestamps,
|
||||
accountID: ulid("account_id"),
|
||||
oldAccountID: ulid("old_account_id"),
|
||||
email: varchar("email", { length: 255 }),
|
||||
oldEmail: varchar("old_email", { length: 255 }),
|
||||
name: varchar("name", { length: 255 }).notNull(),
|
||||
|
|
@ -16,5 +18,9 @@ export const UserTable = mysqlTable(
|
|||
color: int("color"),
|
||||
role: mysqlEnum("role", UserRole).notNull(),
|
||||
},
|
||||
(table) => [...workspaceIndexes(table), uniqueIndex("user_email").on(table.workspaceID, table.email)],
|
||||
(table) => [
|
||||
...workspaceIndexes(table),
|
||||
uniqueIndex("user_account_id").on(table.workspaceID, table.accountID),
|
||||
uniqueIndex("user_email").on(table.workspaceID, table.email),
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue