Database access in data migrations defaults to the 'default' database. Force it to the user selected database instead.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-09-19 20:53:04 -04:00
parent fdfa4755e9
commit eda8d18146
13 changed files with 31 additions and 26 deletions

View File

@@ -7,7 +7,7 @@ from django.db import models, migrations
def make_existing_documents_not_stubs(apps, schema_editor):
Document = apps.get_model('documents', 'Document')
for document in Document.objects.all():
for document in Document.objects.using(schema_editor.connection.alias).all():
document.is_stub = False
document.save()