All files / web/src/db/schema verification-tokens.ts

100% Statements 28/28
100% Branches 1/1
100% Functions 0/0
100% Lines 28/28

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 292x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 39x 39x 39x 2x 2x 2x 2x  
import { integer, primaryKey, sqliteTable, text } from 'drizzle-orm/sqlite-core'
 
/**
 * Verification tokens table - for magic link email verification
 *
 * NextAuth's email provider requires this table to store
 * one-time-use tokens for email sign-in links.
 */
export const verificationTokens = sqliteTable(
  'verification_tokens',
  {
    /** Email address the token was sent to */
    identifier: text('identifier').notNull(),
 
    /** The unique verification token */
    token: text('token').notNull().unique(),
 
    /** When this token expires (unix timestamp) */
    expires: integer('expires', { mode: 'timestamp' }).notNull(),
  },
  (table) => ({
    /** Composite primary key */
    pk: primaryKey({ columns: [table.identifier, table.token] }),
  })
)
 
export type VerificationToken = typeof verificationTokens.$inferSelect
export type NewVerificationToken = typeof verificationTokens.$inferInsert