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:
@@ -10,9 +10,9 @@ def create_parsing_setting_for_existing_document_types(apps, schema_editor):
|
||||
DocumentType = apps.get_model('documents', 'DocumentType')
|
||||
DocumentTypeSettings = apps.get_model('document_parsing', 'DocumentTypeSettings')
|
||||
|
||||
for document_type in DocumentType.objects.all():
|
||||
for document_type in DocumentType.objects.using(schema_editor.connection.alias).all():
|
||||
try:
|
||||
DocumentTypeSettings.objects.create(document_type=document_type)
|
||||
DocumentTypeSettings.objects.using(schema_editor.connection.alias).create(document_type=document_type)
|
||||
except DocumentTypeSettings.DoesNotExist:
|
||||
pass
|
||||
|
||||
@@ -21,9 +21,9 @@ def delete_parsing_setting_for_existing_document_types(apps, schema_editor):
|
||||
DocumentType = apps.get_model('documents', 'DocumentType')
|
||||
DocumentTypeSettings = apps.get_model('document_parsing', 'DocumentTypeSettings')
|
||||
|
||||
for document_type in DocumentType.objects.all():
|
||||
for document_type in DocumentType.objects.using(schema_editor.connection.alias).all():
|
||||
try:
|
||||
DocumentTypeSettings.objects.get(document_type=document_type).delete()
|
||||
DocumentTypeSettings.objects.using(schema_editor.connection.alias).get(document_type=document_type).delete()
|
||||
except DocumentTypeSettings.DoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user