﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
29039	Disabling migrations doesn't work with --keepdb	Vackar Afzal	nobody	"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,
        )
}}}



"	Bug	closed	Testing framework	dev	Normal	fixed	database, tests, migrations	Davor Lučić	Accepted	0	0	0	0	0	0
