#29039: Disabling migrations doesn't work with --keepdb
-------------------------------------+-------------------------------------
Reporter: Vackar | Owner: nobody
Afzal |
Type: | Status: new
Uncategorized |
Component: | Version: 1.11
Migrations | Keywords: database, tests,
Severity: Normal | migrations
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
We have a large number of migrations in our application now, and as a
result it can take 20 mins to create a test DB.
To make this faster I am settings MIGRATION_MODULES in my settings as
follows:
{{{
MIGRATION_MODULES = {}
for app in INSTALLED_APPS:
if app.startswith('django.contrib.'):
app=app.replace('django.contrib.', '')
MIGRATION_MODULES[app] = None
}}}
I've found that this breaks the --keepdb option as it Django wants to run
sync_db internally every time.
The workaround I found is to modify django.db.backends.creation.py (lines
64 to 70) from
{{{
call_command(
'migrate',
verbosity=max(verbosity - 1, 0),
interactive=False,
database=self.connection.alias,
run_syncdb=true,
)
}}}
To
{{{
call_command(
'migrate',
verbosity=max(verbosity - 1, 0),
interactive=False,
database=self.connection.alias,
run_syncdb=not keepdb,
)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29039>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.a608cd0327c3cb73178820948134800f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.