import { sql } from 'drizzle-orm'; import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core'; export const user = sqliteTable('user', { id: text('id').primaryKey(), did: text('did').notNull(), handle: text('handle').notNull(), created_at: text('created_at') .notNull() .default(sql`CURRENT_TIMESTAMP`), updated_at: text('updated_at') .notNull() .default(sql`CURRENT_TIMESTAMP`), username: text('username').notNull().unique(), passwordHash: text('password_hash').notNull() }); export const session = sqliteTable('session', { id: text('id').primaryKey(), userId: text('user_id') .notNull() .references(() => user.id), expiresAt: integer('expires_at', { mode: 'timestamp' }).notNull() }); export type Session = typeof session.$inferSelect; export type User = typeof user.$inferSelect;