fix(auth): make users.hashed_password nullable

Better-Auth inserts into users without a hashed_password value (passwords
are stored in the accounts table). This was causing a NOT NULL constraint
violation and 422 FAILED_TO_CREATE_USER on sign-up.

Revision ID: 003_make_users_hashed_password_nullable
Resolves: CAR-172

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Barcode Betty
2026-03-30 19:10:43 +00:00
parent 835aff3522
commit 146322f51e
2 changed files with 27 additions and 1 deletions
@@ -0,0 +1,26 @@
"""Make users.hashed_password nullable.
Better-Auth inserts users without hashed_password (passwords live in the
accounts table). This column is now purely optional.
Revision ID: 003_make_users_hashed_password_nullable
Revises: 002_better_auth_tables
Create Date: 2026-03-30
"""
import sqlalchemy as sa
from alembic import op
revision = "003_make_users_hashed_password_nullable"
down_revision = "002_better_auth_tables"
branch_labels = None
depends_on = None
def upgrade() -> None:
op.alter_column("users", "hashed_password", existing_type=sa.String(255), nullable=True)
def downgrade() -> None:
op.alter_column("users", "hashed_password", existing_type=sa.String(255), nullable=False)