feat(api): add better-auth admin plugin + close public sign-up (migration 0002)

This commit is contained in:
Bas van Rossem
2026-06-17 17:36:26 +02:00
parent f6bd8eb036
commit c73fa0f898
7 changed files with 626 additions and 37 deletions

View File

@@ -11,6 +11,10 @@ export const user = sqliteTable('user', {
email: text('email').notNull().unique(),
emailVerified: integer('email_verified', { mode: 'boolean' }).default(false).notNull(),
image: text('image'),
role: text('role'),
banned: integer('banned', { mode: 'boolean' }),
banReason: text('ban_reason'),
banExpires: integer('ban_expires', { mode: 'timestamp_ms' }),
createdAt: integer('created_at', { mode: 'timestamp_ms' })
.default(sql`(cast(unixepoch('subsecond') * 1000 as integer))`)
.notNull(),
@@ -34,6 +38,7 @@ export const session = sqliteTable(
.notNull(),
ipAddress: text('ip_address'),
userAgent: text('user_agent'),
impersonatedBy: text('impersonated_by'),
userId: text('user_id')
.notNull()
.references(() => user.id, { onDelete: 'cascade' }),