full-stack-fastapi-template
full-stack-fastapi-template copied to clipboard
Enhance Database Modeling and SQLAlchemy Compatibility
This pull request makes several changes to the backend/app/models.py file to enhance database modeling and improve compatibility with SQLAlchemy. The key updates include adjustments to field definitions, changes to relationships, and the removal of certain constraints.
Changes to field definitions:
- Updated the
emailfield inUserBaseto explicitly usesa_type=String(255)for better SQLAlchemy compatibility. - Changed the
emailfield type inUserRegister,UserUpdate, andUserUpdateMefromEmailStrtostrfor consistency and to avoid type-related issues.
Changes to relationships:
- Modified the
itemsrelationship in theUsermodel to includesa_relationship_kwargsfor defining cascading behavior and specifying join conditions. - Updated the
owner_idfield in theItemmodel to remove theforeign_keyconstraint while keeping it indexed for performance. Addedsa_relationship_kwargsto theownerrelationship for explicit join conditions.