2024-07-11 22:53:56 +00:00
|
|
|
import { boolean, pgTable, text, uuid } from 'drizzle-orm/pg-core';
|
2024-05-08 00:19:13 +00:00
|
|
|
import type { InferSelectModel } from 'drizzle-orm';
|
|
|
|
|
import users from './users';
|
2024-07-11 22:53:56 +00:00
|
|
|
import { timestamps } from '../utils';
|
2024-05-08 00:19:13 +00:00
|
|
|
|
|
|
|
|
const recovery_codes = pgTable('recovery_codes', {
|
|
|
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
|
|
|
userId: uuid('user_id')
|
|
|
|
|
.notNull()
|
|
|
|
|
.references(() => users.id),
|
|
|
|
|
code: text('code').notNull(),
|
|
|
|
|
used: boolean('used').default(false),
|
2024-07-11 22:53:56 +00:00
|
|
|
...timestamps,
|
2024-05-08 00:19:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type RecoveryCodes = InferSelectModel<typeof recovery_codes>;
|
|
|
|
|
|
|
|
|
|
export default recovery_codes;
|