#29039: Disabling migrations doesn't work with --keepdb
-------------------------------------+-------------------------------------
Reporter: Vackar Afzal | Owner: Anoosha
| keen
Type: Uncategorized | Status: assigned
Component: Migrations | Version: 1.11
Severity: Normal | Resolution:
Keywords: database, tests, | Triage Stage:
migrations | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Anoosha keen):
**I get this error:**
if name.startswith('.'):
AttributeError: 'NoneType' object has no attribute 'startswith'
When I add the given code to setting.py I got the error mentioned
above.Can you explain this please?
Replying to [ticket:29039 Vackar Afzal]:
> 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#comment:2>
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/069.7bb1d3683e62bab9d8e6fb7127db6446%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.