Opened 3 years ago
Closed 3 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):
- Creating a separate settings file that uses the dummy backend for
DATABASES['default']
- Using an env variable to switch to the dummy backend in your settings file
- 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)
follow-up: 2 comment:1 by , 3 years ago
comment:2 by , 3 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 db backend to timeout, which is adding an extra 30s on a check which should take less than 10.
comment:3 by , 3 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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.
This seems to be a duplicate of #31504. Is that not working for you?