Opened 2 years ago

Closed 2 years ago

#33421 closed New feature (wontfix)

Skip consistency checks on makemigrations

Reported by: Tim Nyborg Owned by: nobody
Component: Migrations Version: 4.0
Severity: Normal Keywords: makemigrations databases
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

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 section.

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

Change History (3)

comment:1 by Tim Graham, 2 years ago

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

in reply to:  1 comment:2 by Tim Nyborg, 2 years ago

Replying to 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 the db backend to timeout, which is adding an extra 30s on a check which should take less than 10.

Last edited 2 years ago by Tim Nyborg (previous) (diff)

comment:3 by Mariusz Felisiak, 2 years ago

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top