mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
20 lines
No EOL
575 B
TypeScript
20 lines
No EOL
575 B
TypeScript
import { pgTable, text, uuid } from "drizzle-orm/pg-core";
|
|
import { timestamps } from '../utils';
|
|
import { usersTable } from "./users.table";
|
|
|
|
enum CredentialsType {
|
|
SECRET = 'secret',
|
|
PASSWORD = 'password',
|
|
TOTP = 'totp',
|
|
HOTP = 'hotp'
|
|
}
|
|
|
|
export const credentialsTable = pgTable('credentials', {
|
|
id: uuid('id').primaryKey().defaultRandom(),
|
|
user_id: uuid('user_id')
|
|
.notNull()
|
|
.references(() => usersTable.id, { onDelete: 'cascade' }),
|
|
type: text('type').notNull().default(CredentialsType.PASSWORD),
|
|
secret_data: text('secret_data').notNull(),
|
|
...timestamps
|
|
}); |