Added a pre-commit check to fail in case user forgot to commit migration files

This commit is contained in:
Arnav Choudhury 2024-04-06 13:53:28 +05:30
parent 8060df4c51
commit 7d8bf4eaf5

View File

@ -49,6 +49,19 @@ repos:
- id: djlint-reformat-django
- id: djlint-django
- repo: local
hooks:
- id: check-migrations
name: check-migrations
{%- if cookiecutter.use_docker == 'y' %}
entry: /usr/bin/env bash -c "bash .envs/.local/.django && bash .envs/.local/.postgres && docker compose -f local.yml run --rm django bash -c 'python manage.py makemigrations --check --dry-run'"
{%- else %}
entry: /usr/bin/env bash -c "bash .envs/.local/.django && bash .envs/.local/.postgres && python manage.py makemigrations --check --dry-run"
{%- endif %}
types: [ python ]
pass_filenames: false
language: system
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci:
autoupdate_schedule: weekly