codalware-auth
Version:
Complete authentication system with enterprise security, attack protection, team workspaces, waitlist, billing, UI components, 2FA, and account recovery - production-ready in 5 minutes. Enhanced CLI with verification, rollback, and App Router scaffolding.
32 lines (28 loc) • 1.16 kB
text/typescript
// @ts-expect-error missing types for drizzle-orm/pg-core
import { pgTable, text, timestamp, uuid, jsonb } from 'drizzle-orm/pg-core';
export const users = pgTable('users', {
id: uuid('id').defaultRandom().primaryKey(),
email: text('email').notNull(),
name: text('name'),
metadata: jsonb('metadata'),
created_at: timestamp('created_at').defaultNow(),
updated_at: timestamp('updated_at').defaultNow(),
});
export const sessions = pgTable('sessions', {
id: uuid('id').defaultRandom().primaryKey(),
user_id: uuid('user_id').references(() => users.id),
handle: text('handle'),
created_at: timestamp('created_at').defaultNow(),
expires_at: timestamp('expires_at').notNull(),
metadata: jsonb('metadata'),
});
export const magic_tokens = pgTable('magic_tokens', {
id: uuid('id').defaultRandom().primaryKey(),
token_hash: text('token_hash').notNull(),
user_id: uuid('user_id').references(() => users.id),
created_at: timestamp('created_at').defaultNow(),
expires_at: timestamp('expires_at').notNull(),
consumed_at: timestamp('consumed_at'),
ip: text('ip'),
user_agent: text('user_agent'),
});