Guide for extending the system with new database models
src/models
directory with a descriptive name that follows the naming convention of existing model files (e.g., my_feature_model.py
).
src/models/__init__.py
file to import and expose your new model:
migrations/versions
directory to ensure it correctly creates the intended table and relationships.
src/services/my_feature/schema.py
). These classes will be used for request validation and serialization.
CRUD
for models that need standard CRUD operations, and Base
for association tables or models with specialized operations.
String(255)
for short text fieldsText
for longer text contentJSONB
for structured data/configurationsUUID
for all IDs and foreign keysForeignKey
constraints with appropriate ondelete
behaviorCASCADE
for parent-child relationships where child records should be deleted when parent is deletedSET NULL
where records should be preserved but reference removednullable=False
for required fields