Skip to content

Commit

Permalink
Use get_active_content_database to get alias
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles authored Mar 21, 2023
1 parent eb0a659 commit 385cda0
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 385cda0

Please sign in to comment.