DB schema mismatch: email_verified is timestamp instead of boolean #9

Closed
opened 2026-04-27 17:28:12 +00:00 by TopherMayor · 0 comments
Owner

Description

E2E testing revealed that user sign-up is completely broken due to a database schema mismatch.

Root Cause

The users.email_verified column is defined as timestamp with time zone but Better Auth sends a boolean (false) for this field.

column "email_verified" is of type timestamp with time zone but expression is of type boolean

Impact

  • No user can sign up (HTTP 422: FAILED_TO_CREATE_USER)
  • No user can sign in (no users exist)
  • The entire app is non-functional for authenticated flows

Evidence

POST /api/auth/sign-up/email -> 422 {"message":"Failed to create user","code":"FAILED_TO_CREATE_USER"}

DB schema:

email_verified | timestamp with time zone | (nullable)

Better Auth sends:

insert into "users" (...) values (..., $4=false, ...)

Fix

Migration to alter the column:

ALTER TABLE users ALTER COLUMN email_verified TYPE boolean USING (email_verified IS NOT NULL);

Severity: Critical - blocks all authenticated functionality.

## Description E2E testing revealed that user sign-up is completely broken due to a database schema mismatch. ## Root Cause The `users.email_verified` column is defined as `timestamp with time zone` but Better Auth sends a boolean (`false`) for this field. ``` column "email_verified" is of type timestamp with time zone but expression is of type boolean ``` ## Impact - No user can sign up (HTTP 422: FAILED_TO_CREATE_USER) - No user can sign in (no users exist) - The entire app is non-functional for authenticated flows ## Evidence ``` POST /api/auth/sign-up/email -> 422 {"message":"Failed to create user","code":"FAILED_TO_CREATE_USER"} ``` DB schema: ``` email_verified | timestamp with time zone | (nullable) ``` Better Auth sends: ```sql insert into "users" (...) values (..., $4=false, ...) ``` ## Fix Migration to alter the column: ```sql ALTER TABLE users ALTER COLUMN email_verified TYPE boolean USING (email_verified IS NOT NULL); ``` ## Severity: Critical - blocks all authenticated functionality.
TopherMayor added the bug label 2026-04-27 17:28:12 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TopherMayor/comparaison#9