2024-07-25 00:39:03 +00:00
|
|
|
import { boolean, pgTable, text, uuid } from 'drizzle-orm/pg-core';
|
|
|
|
|
import type { InferSelectModel } from 'drizzle-orm';
|
2024-08-01 23:46:29 +00:00
|
|
|
import { usersTable } from './users.table';
|
2024-07-25 00:39:03 +00:00
|
|
|
import { timestamps } from '../utils';
|
|
|
|
|
|
2024-08-07 17:01:38 +00:00
|
|
|
export const recovery_codes = 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,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type RecoveryCodes = InferSelectModel<typeof recovery_codes>;
|