2026-02-28 18:54:04 +00:00
|
|
|
import { sqliteTable, text, integer, primaryKey } from "drizzle-orm/sqlite-core"
|
2026-02-14 04:19:02 +00:00
|
|
|
import { Timestamps } from "@/storage/schema.sql"
|
|
|
|
|
|
2026-02-28 18:54:04 +00:00
|
|
|
export const AccountTable = sqliteTable(
|
|
|
|
|
"account",
|
2026-02-14 04:19:02 +00:00
|
|
|
{
|
|
|
|
|
email: text().notNull(),
|
|
|
|
|
url: text().notNull(),
|
|
|
|
|
access_token: text().notNull(),
|
|
|
|
|
refresh_token: text().notNull(),
|
|
|
|
|
token_expiry: integer(),
|
|
|
|
|
active: integer({ mode: "boolean" })
|
|
|
|
|
.notNull()
|
|
|
|
|
.$default(() => false),
|
|
|
|
|
...Timestamps,
|
|
|
|
|
},
|
|
|
|
|
(table) => [
|
|
|
|
|
primaryKey({ columns: [table.email, table.url] }),
|
|
|
|
|
// uniqueIndex("control_account_active_idx").on(table.email).where(eq(table.active, true)),
|
|
|
|
|
],
|
|
|
|
|
)
|