Pawla Abdul
5c8fe9a62b
fix(api): make alembic migrations idempotent for fresh databases
...
- 001: guard has_table check; skip if session_data already TEXT
- 002: guard each ADD COLUMN / CREATE TABLE; guard password migration
- 003: guard has_table; guard nullable check
- 004: guard has_table; skip if users.id already TEXT
- env.py: add Base.metadata.create_all after run_migrations to bootstrap fresh DBs
- api/user.py: make hashed_password nullable; add email_verified, image, email_inbound_token fields
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-04 16:28:29 +00:00
Stockboy Steve
a1d53f8e47
fix: change users.id and FK columns from uuid to text for Better-Auth compatibility
...
Better-Auth generates nanoid-style text IDs (e.g. pGud2ln2WAFHC0KYjBVKR4Rc7mM8OcTI),
but the users table used PostgreSQL uuid type, causing registration failures:
ERROR: invalid input syntax for type uuid: "pGud2ln2WAFHC0KYjBVKR4Rc7mM8OcTI"
Changes:
- User.id: removed UUIDPrimaryKeyMixin, use explicit text PK
- UserStoreAccount.user_id: Mapped[uuid.UUID] -> Mapped[str]
- Purchase.user_id: Mapped[uuid.UUID] -> Mapped[str]
- UserResponse schema: id field from UUID -> str
- New Alembic migration 004_fix_user_id_text: drops FKs, alters column
types, re-adds FKs (using id::text cast)
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-03-31 17:56:13 +00:00