Skip to content

Commit 89f3875

Browse files
committed
Added a pre-commit check to fail in case user forgot to commit migration files
1 parent 83ceb39 commit 89f3875

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

{{cookiecutter.project_slug}}/.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ repos:
4949
- id: djlint-reformat-django
5050
- id: djlint-django
5151

52+
- repo: local
53+
hooks:
54+
- id: check-migrations
55+
name: check-migrations
56+
{%- if cookiecutter.use_docker == 'y' %}
57+
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'"
58+
{%- else %}
59+
entry: /usr/bin/env bash -c "bash .envs/.local/.django && bash .envs/.local/.postgres && python manage.py makemigrations --check --dry-run"
60+
{%- endif %}
61+
types: [ python ]
62+
pass_filenames: false
63+
language: system
64+
5265
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
5366
ci:
5467
autoupdate_schedule: weekly

0 commit comments

Comments
 (0)