From 385cda06f5b167541c65d6829e2c513764529799 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 21 Mar 2023 13:31:37 -0700 Subject: [PATCH] Use get_active_content_database to get alias --- .../management/commands/export_channels_to_kolibri_public.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contentcuration/kolibri_public/management/commands/export_channels_to_kolibri_public.py b/contentcuration/kolibri_public/management/commands/export_channels_to_kolibri_public.py index f816c2cfc9..2f20a0b78c 100644 --- a/contentcuration/kolibri_public/management/commands/export_channels_to_kolibri_public.py +++ b/contentcuration/kolibri_public/management/commands/export_channels_to_kolibri_public.py @@ -9,6 +9,7 @@ from django.core.management.base import BaseCommand from kolibri_content.apps import KolibriContentConfig from kolibri_content.models import ChannelMetadata as ExportedChannelMetadata +from kolibri_content.router import get_active_content_database from kolibri_content.router import using_content_database from kolibri_public.models import ChannelMetadata from kolibri_public.utils.mapper import ChannelMapper @@ -29,7 +30,7 @@ def _export_channel(self, channel_id): db_file.seek(0) with using_content_database(db_file.name): # Run migration to handle old content databases published prior to current fields being added. - call_command("migrate", app_label=KolibriContentConfig.label, database=db_file.name) + call_command("migrate", app_label=KolibriContentConfig.label, database=get_active_content_database()) channel = ExportedChannelMetadata.objects.get(id=channel_id) logger.info("Found channel {} for id: {} mapping now".format(channel.name, channel_id)) mapper = ChannelMapper(channel)