boredgame/src/lib/server/api/databases/tables/recovery-codes.table.ts

17 lines
566 B
TypeScript
Raw Normal View History

import type { InferSelectModel } from 'drizzle-orm'
import { boolean, pgTable, text, uuid } from 'drizzle-orm/pg-core'
2024-09-04 23:04:41 +00:00
import { timestamps } from '../../common/utils/table'
import { usersTable } from './users.table'
export const recoveryCodesTable = pgTable('recovery_codes', {
id: uuid('id').primaryKey().defaultRandom(),
userId: uuid('user_id')
.notNull()
.references(() => usersTable.id),
code: text('code').notNull(),
used: boolean('used').default(false),
...timestamps,
})
export type RecoveryCodesTable = InferSelectModel<typeof recoveryCodesTable>