2024-05-08 00:19:13 +00:00
|
|
|
import { boolean, pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core';
|
|
|
|
|
import type { InferSelectModel } from 'drizzle-orm';
|
|
|
|
|
import users from './users';
|
|
|
|
|
|
|
|
|
|
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-06-12 02:12:12 +00:00
|
|
|
created_at: timestamp('created_at').notNull().defaultNow(),
|
|
|
|
|
updated_at: timestamp('updated_at').notNull().defaultNow(),
|
2024-05-08 00:19:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export type RecoveryCodes = InferSelectModel<typeof recovery_codes>;
|
|
|
|
|
|
|
|
|
|
export default recovery_codes;
|