mirror of
https://github.com/nestriness/nestri.git
synced 2026-09-20 01:35:19 +03:00
feat: Sync to OSS repo
This commit is contained in:
24
packages/core/src/user/linked-account.sql.ts
Normal file
24
packages/core/src/user/linked-account.sql.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { index, jsonb, pgEnum, pgTable, text, uniqueIndex } from 'drizzle-orm/pg-core';
|
||||
|
||||
import { id, timestamps, ulid } from '../db/types.js';
|
||||
import { UserTable } from '../user/user.sql.js';
|
||||
|
||||
export const ProviderEnum = pgEnum('linked_account_provider', ['steam', 'ssh', 'discord']);
|
||||
|
||||
export const LinkedAccountTable = pgTable(
|
||||
'linked_account',
|
||||
{
|
||||
...id,
|
||||
...timestamps,
|
||||
userId: ulid('user_id')
|
||||
.notNull()
|
||||
.references(() => UserTable.id, { onDelete: 'cascade' }),
|
||||
provider: ProviderEnum('provider').notNull(),
|
||||
providerAccountId: text('provider_account_id').notNull(),
|
||||
profile: jsonb('profile').$type<{}>()
|
||||
},
|
||||
(t) => [
|
||||
uniqueIndex('linked_account_provider_unique').on(t.provider, t.providerAccountId),
|
||||
index('linked_account_user_idx').on(t.userId)
|
||||
]
|
||||
);
|
||||
Reference in New Issue
Block a user