Django "makemigrations --check" reports changes detected in CI
A CI gate runs makemigrations --check --dry-run to ensure every model change has a committed migration. When it exits non-zero, a developer changed a model but did not generate and commit the migration file.
What this error means
The gate step fails with a non-zero exit and a message that changes were detected, such as "Your models in app(s): 'app' have changes that are not yet reflected in a migration."
Your models in app(s): 'app' have changes that are not yet reflected in a migration,
and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, ...Common causes
A model changed without a new migration
A field was added or altered but makemigrations was never run, so the schema in code and the migration graph diverge.
The migration file was not committed
The migration was generated locally but left out of the commit, so CI sees pending changes.
How to fix it
Generate and commit the migration
- Run
python manage.py makemigrationslocally. - Review and commit the new migration file.
- Re-run the gate to confirm no changes remain.
python manage.py makemigrations
git add app/migrations/Keep the gate in CI
Fail the build when a model change lacks a migration so it never reaches production.
- run: python manage.py makemigrations --check --dry-runHow to prevent it
- Run makemigrations whenever a model changes and commit the file.
- Keep makemigrations --check --dry-run as a required CI gate.
- Review migration files in code review alongside model changes.