Opened 6 years ago
Last modified 6 years ago
#31021 closed Bug
migration doesn't work on multi database environment. — at Version 5
| Reported by: | haudoing | Owned by: | nobody | 
|---|---|---|---|
| Component: | contrib.auth | Version: | 2.2 | 
| Severity: | Release blocker | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description (last modified by )
The tutorial said that we can omit to set the default database if default doesn't makes sense
https://docs.djangoproject.com/en/2.2/topics/db/multi-db/#defining-your-databases
But the following migration script doesn't work after configuration with empty default database
https://github.com/django/django/blob/stable/2.2.x/django/contrib/auth/migrations/0011_update_proxy_permissions.py
on line 42, it use
            with transaction.atomic():
                Permission.objects.filter(
                    permissions_query,
                    content_type=old_content_type,
                ).update(content_type=new_content_type)
This will brake the migration if default database doesn't set
Tracebacks
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
      Change History (5)
comment:1 by , 6 years ago
| Resolution: | → worksforme | 
|---|---|
| Status: | new → closed | 
| Summary: | migration doesn't work on multi database environment → migration doesn't work on multi database environment. | 
comment:2 by , 6 years ago
Sorry for my poor English. I doesn't express it well. What I mean to say is not migration script brake the multi db setting. I want to say after configure multi database setting without default, the migration script won't work. It throw the following exception while migrate
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
comment:3 by , 6 years ago
| Resolution: | worksforme | 
|---|---|
| Status: | closed → new | 
comment:4 by , 6 years ago
| Description: | modified (diff) | 
|---|
comment:5 by , 6 years ago
| Description: | modified (diff) | 
|---|
This migration doesn't brake anything for me. I checked with an example from docs and it doesn't require a
defaultDB.