import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core' export const user = sqliteTable('user', { id: text('id').primaryKey(), name: text('name').notNull(), email: text('email').notNull().unique(), emailVerifiedAt: integer('emailVerifiedAt', { mode: 'timestamp' }), image: text('image'), role: text('role').notNull().default('user'), createdAt: integer('createdAt', { mode: 'timestamp' }).notNull().$defaultFn(() => new Date()), updatedAt: integer('updatedAt', { mode: 'timestamp' }).notNull().$defaultFn(() => new Date()), }) export const session = sqliteTable('session', { id: text('id').primaryKey(), expiresAt: integer('expiresAt', { mode: 'timestamp' }).notNull(), token: text('token').notNull().unique(), createdAt: integer('createdAt', { mode: 'timestamp' }).notNull(), updatedAt: integer('updatedAt', { mode: 'timestamp' }).notNull(), ipAddress: text('ipAddress'), userAgent: text('userAgent'), userId: text('userId').notNull().references(() => user.id, { onDelete: 'cascade' }), }) export const account = sqliteTable('account', { id: text('id').primaryKey(), accountId: text('accountId').notNull(), providerId: text('providerId').notNull(), userId: text('userId').notNull().references(() => user.id, { onDelete: 'cascade' }), accessToken: text('accessToken'), refreshToken: text('refreshToken'), idToken: text('idToken'), accessTokenExpiresAt: integer('accessTokenExpiresAt', { mode: 'timestamp' }), refreshTokenExpiresAt: integer('refreshTokenExpiresAt', { mode: 'timestamp' }), scope: text('scope'), password: text('password'), createdAt: integer('createdAt', { mode: 'timestamp' }).notNull(), updatedAt: integer('updatedAt', { mode: 'timestamp' }).notNull(), }) export const verification = sqliteTable('verification', { id: text('id').primaryKey(), identifier: text('identifier').notNull(), value: text('value').notNull(), expiresAt: integer('expiresAt', { mode: 'timestamp' }).notNull(), createdAt: integer('createdAt', { mode: 'timestamp' }), updatedAt: integer('updatedAt', { mode: 'timestamp' }), })