Skip to content
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.

Pre-commit hook for Django's makemigrations command.

License

Notifications You must be signed in to change notification settings

tj-pre-commit/django-makemigrations

Repository files navigation

django-makemigrations

Run Django's makemigrations as a pre-commit hook.

graphene-django-precommit-hook

pre-commit hook to generate django migrations

See pre-commit for installation instructions

Sample basic .pre-commit-config.yaml

-   repo: https://github.com/tj-pre-commit/django-makemigrations
    rev: v1.0.0
    hooks:
      - id: django-makemigrations
        stages: [commit]

Sample complex .pre-commit-config.yaml

-   repo: https://github.com/tj-pre-commit/django-makemigrations
    rev: v1.0.0
    hooks:
      - id: django-makemigrations
        stages: [commit]
        args: [
          '--settings',
          'project.settings',  # Defaults to: DJANGO_SETTINGS_MODULE
          '--merge',  # Enables fixing of migration conflicts.
          '--empty',  # Creates an empty migration.
          '--no-input',  # Do not prompt for user input.
          '--verbosity', # OR '-v'
          '2', # Set the verbosity level {0,1,2,3}
          #  See https://docs.djangoproject.com/en/3.1/ref/django-admin/#makemigrations for more information
        ]