feat: redesign match play and add broadcast tooling
This commit is contained in:
@@ -1,15 +1,37 @@
|
||||
// src/lib/server/db/auth.schema.ts
|
||||
import { relations } from 'drizzle-orm';
|
||||
import { pgTable, text, timestamp, boolean, index } from 'drizzle-orm/pg-core';
|
||||
import {
|
||||
pgTable,
|
||||
text,
|
||||
timestamp,
|
||||
boolean,
|
||||
index,
|
||||
integer,
|
||||
uniqueIndex
|
||||
} from 'drizzle-orm/pg-core';
|
||||
import { jsonb } from './jsonb';
|
||||
import type { ConnectionProfile } from '$lib/auth-identity';
|
||||
|
||||
export const user = pgTable('user', {
|
||||
id: text('id').primaryKey(),
|
||||
name: text('name').notNull(),
|
||||
email: text('email').notNull().unique(),
|
||||
// Only actual contact addresses belong here. OAuth identity lives in account.
|
||||
email: text('contact_email').unique(),
|
||||
// Better Auth's required email field is mapped to this private compatibility field.
|
||||
authEmail: text('email').notNull().unique(),
|
||||
emailVerified: boolean('email_verified').default(false).notNull(),
|
||||
image: text('image'),
|
||||
// ── Staff role: 'player' | 'referee' | 'admin' ──
|
||||
role: text('role').default('player').notNull(),
|
||||
rootAdmin: boolean('root_admin').default(false).notNull(),
|
||||
mergedIntoUserId: text('merged_into_user_id'),
|
||||
osuId: integer('osu_id'),
|
||||
countryCode: text('country_code'),
|
||||
discordId: text('discord_id'),
|
||||
bannedAt: timestamp('banned_at', { withTimezone: true }),
|
||||
timezone: text('timezone'),
|
||||
/** Local hours (0–23) the player can play. Empty means no preference. */
|
||||
availableHours: jsonb('available_hours').$type<number[]>(),
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at')
|
||||
.defaultNow()
|
||||
@@ -52,12 +74,17 @@ export const account = pgTable(
|
||||
refreshTokenExpiresAt: timestamp('refresh_token_expires_at'),
|
||||
scope: text('scope'),
|
||||
password: text('password'),
|
||||
profile: jsonb('profile').$type<ConnectionProfile>(),
|
||||
createdAt: timestamp('created_at').defaultNow().notNull(),
|
||||
updatedAt: timestamp('updated_at')
|
||||
.$onUpdate(() => new Date())
|
||||
.notNull()
|
||||
},
|
||||
(table) => [index('account_userId_idx').on(table.userId)]
|
||||
(table) => [
|
||||
index('account_userId_idx').on(table.userId),
|
||||
uniqueIndex('account_provider_identity_idx').on(table.providerId, table.accountId),
|
||||
uniqueIndex('account_user_provider_idx').on(table.userId, table.providerId)
|
||||
]
|
||||
);
|
||||
|
||||
export const verification = pgTable(
|
||||
|
||||
Reference in New Issue
Block a user