Changes:
- Removed server_default with CURRENT_TIMESTAMP from User model (SQLite doesn't support non-constant defaults in ALTER TABLE)
- Updated migrations 002 and 003 to add datetime columns without server defaults
- Added manual timestamp updates using SQLite's datetime('now') function in migrations
- Modified User model to handle timestamps in Python code instead of database defaults
- Updated profile routes to manually set updated_at timestamps on profile changes
- Enhanced User model __init__ to set default timestamps for new users
This resolves the 'Cannot add a column with non-constant default' SQLite error
while maintaining proper timestamp functionality.
Changes:
- Enhanced migration 002 with column existence checks to prevent duplicate column errors
- Added comprehensive migration 003 that syncs database with current model state
- Modified application startup to avoid conflicts between create_all() and Alembic
- Added proper table/column existence checking in migrations
- Improved migration safety for production environments
- Removed automatic table creation when database already exists (relies on migrations)
This resolves the 'duplicate column name' error by ensuring migrations
check for existing columns before attempting to add them.
Features:
- Extended User model with profile fields (first_name, last_name, phone, bio, preferred_language, timezone)
- Complete profile endpoints for viewing and updating user information
- Password update functionality with current password verification
- Email update functionality with duplicate email checking
- Account deletion endpoint
- Database migration for new profile fields
- Enhanced logging and error handling for all profile operations
- Updated API documentation with profile endpoints
Profile fields include:
- Personal information (name, phone, bio)
- Preferences (language, timezone)
- Account management (password, email updates)
- Timestamps (created_at, updated_at)