Migrations and Data Changes¶
Migration Principles¶
- Keep migrations small and focused.
- Avoid mixing unrelated model changes.
- Review generated migration operations before commit.
Standard Commands¶
docker compose run --rm app python manage.py makemigrations
docker compose run --rm app python manage.py migrate
Data Safety¶
Before schema changes
Take a backup before significant data model updates, especially before release or demo milestones.
Troubleshooting¶
- If migration history diverges between branches, rebase and regenerate carefully.
- Validate startup with
python manage.py checkafter migration changes.