Check for pending Django migrations

前端 未结 8 2058
孤独总比滥情好
孤独总比滥情好 2021-02-01 13:05

In Django, is there an easy way to check whether all database migrations have been run? I\'ve found manage.py migrate --list, which gives me the information I want,

8条回答
  •  走了就别回头了
    2021-02-01 13:21

    3.1 release notes

    The new migrate --check option makes the command exit with a non-zero status when unapplied migrations are detected.

    https://docs.djangoproject.com/en/3.1/ref/django-admin/#cmdoption-migrate-check

    so finally we can

    python manage.py migrate --check

提交回复
热议问题