mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-19 18:42:09 +00:00
28 lines
668 B
TypeScript
28 lines
668 B
TypeScript
import {
|
|
index,
|
|
mysqlEnum,
|
|
mysqlTable,
|
|
primaryKey,
|
|
uniqueIndex,
|
|
varchar,
|
|
} from "drizzle-orm/mysql-core"
|
|
import { id, timestamps, ulid } from "../drizzle/types"
|
|
|
|
export const AuthProvider = ["email", "github", "google"] as const
|
|
|
|
export const AuthTable = mysqlTable(
|
|
"auth",
|
|
{
|
|
id: id(),
|
|
...timestamps,
|
|
provider: mysqlEnum("provider", AuthProvider).notNull(),
|
|
subject: varchar("subject", { length: 255 }).notNull(),
|
|
accountID: ulid("account_id").notNull(),
|
|
},
|
|
(table) => [
|
|
primaryKey({ columns: [table.id] }),
|
|
uniqueIndex("provider").on(table.provider, table.subject),
|
|
index("account_id").on(table.accountID),
|
|
],
|
|
)
|