2024-09-01 19:22:00 +00:00
|
|
|
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'
|
2024-09-01 19:22:00 +00:00
|
|
|
import { usersTable } from './users.table'
|
2024-07-25 00:39:03 +00:00
|
|
|
|
2024-08-29 23:12:40 +00:00
|
|
|
export const recoveryCodesTable = pgTable('recovery_codes', {
|
2024-07-25 00:39:03 +00:00
|
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
|
|
|
userId: uuid('user_id')
|
|
|
|
|
.notNull()
|
|
|
|
|
.references(() => usersTable.id),
|
|
|
|
|
code: text('code').notNull(),
|
|
|
|
|
used: boolean('used').default(false),
|
|
|
|
|
...timestamps,
|
2024-09-01 19:22:00 +00:00
|
|
|
})
|
2024-07-25 00:39:03 +00:00
|
|
|
|
2024-09-01 19:22:00 +00:00
|
|
|
export type RecoveryCodesTable = InferSelectModel<typeof recoveryCodesTable>
|