[Django] #33421: Skip consistency checks on makemigrations

25 views
Skip to first unread message

Django

unread,
Jan 7, 2022, 6:51:23 AM1/7/22
to django-...@googlegroups.com
#33421: Skip consistency checks on makemigrations
-------------------------------------+-------------------------------------
Reporter: Tim | Owner: nobody
Nyborg |
Type: New | Status: new
feature |
Component: | Version: 4.0
Migrations | Keywords: makemigrations
Severity: Normal | databases
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
During CI/CD, it's very useful to run `makemigrations --check --dry-run`
to see if migrations have not been created for model changes. Problem is,
`makemigrations` will do migration history consitency checks on the
default database, which won't exist if you're trying to make a lightweight
CI stage.

You can work around this by (for example):
1. Creating a separate settings file that uses the dummy backend for
`DATABASES['default']`
2. Using an env variable to switch to the dummy backend in your settings
file
3. Setting up database routers which disallow migration

But these are all awkward and potentially fragile, adding logic to an
application's core.

I'd suggest adding a `--skip-consistency-checks` flag which simply skips
that
[https://github.com/django/django/blob/0ab58c120939093fea90822f376e1866fc714d1f/django/core/management/commands/makemigrations.py#L93-L113
section].

If this'd be acceptable, I'd be happy to put together a pull request.

--
Ticket URL: <https://code.djangoproject.com/ticket/33421>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 7, 2022, 7:09:10 AM1/7/22
to django-...@googlegroups.com
#33421: Skip consistency checks on makemigrations
-------------------------------------+-------------------------------------
Reporter: Tim Nyborg | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 4.0
Severity: Normal | Resolution:
Keywords: makemigrations | Triage Stage:
databases | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

This seems to be a duplicate of #31504. Is that not working for you?

--
Ticket URL: <https://code.djangoproject.com/ticket/33421#comment:1>

Django

unread,
Jan 7, 2022, 7:47:52 AM1/7/22
to django-...@googlegroups.com
#33421: Skip consistency checks on makemigrations
-------------------------------------+-------------------------------------
Reporter: Tim Nyborg | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 4.0
Severity: Normal | Resolution:
Keywords: makemigrations | Triage Stage:
databases | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Nyborg):

Replying to [comment:1 Tim Graham]:


> This seems to be a duplicate of #31504. Is that not working for you?

My problem with letting it fail gracefully is that it waits for db backend
to timeout, which is adding an extra 30s on a check which should take less
than 10.

--
Ticket URL: <https://code.djangoproject.com/ticket/33421#comment:2>

Django

unread,
Jan 7, 2022, 10:04:36 AM1/7/22
to django-...@googlegroups.com
#33421: Skip consistency checks on makemigrations
-------------------------------------+-------------------------------------
Reporter: Tim Nyborg | Owner: nobody
Type: New feature | Status: closed
Component: Migrations | Version: 4.0
Severity: Normal | Resolution: wontfix

Keywords: makemigrations | Triage Stage:
databases | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => wontfix


Comment:

Thanks for this ticket, however it's quite niche and we've already
provided a solution in this area. A long timeout in your case is not an
sufficient argument for me to prepare another option for it.

--
Ticket URL: <https://code.djangoproject.com/ticket/33421#comment:3>

Reply all
Reply to author
Forward
0 new messages