Skip to content

CICD-308 · Django database migration ​

Encyclopedia · Database delivery and migration · All snippets

Previous · CICD-307 · Next · CICD-309

1. Where it fits ​

  • Placement CI run step.
  • Prerequisites disposable database, migration tools and a scoped database role.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
python manage.py makemigrations --check --dry-run
python manage.py migrate --noinput
python manage.py migrate --check

3. How it works ​

The Django framework compares model state, migration files and applied database revisions through its management command.

4. Verify the result ​

Run with CI database settings. Missing migrations should fail before applying schema.

Validation syntax-validated (Bash parse). Status definitions.