Opened 3 years ago

Last modified 3 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 haudoing)

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 Changed 3 years ago by Mariusz Felisiak

Resolution: worksforme
Status: newclosed
Summary: migration doesn't work on multi database environmentmigration doesn't work on multi database environment.

This migration doesn't brake anything for me. I checked with an example from docs and it doesn't require a default DB.

comment:2 Changed 3 years ago by haudoing

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 Changed 3 years ago by haudoing

Resolution: worksforme
Status: closednew

comment:4 Changed 3 years ago by haudoing

Description: modified (diff)

comment:5 Changed 3 years ago by haudoing

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top