learningequality / kolibri-library

A repository for tracking issues related to the Kolibri Library
MIT License
0 stars 0 forks source link

IntegrityError: The row in table 'content_file' with primary key 'c91d3060ca084219ac8eb8eca9d1389c' has an invali... #2

Open sentry-io[bot] opened 1 year ago

sentry-io[bot] commented 1 year ago

This is related to the persistence of content databases with very old schemas for Sikana (ZH) and CK-12 (ES). They cannot be simply republished, because the channels have been significantly updated in Studio since the last publish, so we need to evaluate if doing the republish is appropriate.

Sentry Issue: STUDIO-GCV

OperationalError: no such table: content_localfile
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/backends/sqlite3/base.py", line 423, in execute
    return Database.Cursor.execute(self, query, params)

OperationalError: no such table: content_localfile
(9 additional frame(s) were not displayed)
...
  File "django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "django/db/backends/sqlite3/base.py", line 423, in execute
    return Database.Cursor.execute(self, query, params)

IntegrityError: The row in table 'content_file' with primary key 'c91d3060ca084219ac8eb8eca9d1389c' has an invalid foreign key: content_file.local_file_id contains a value 'local_file_id' that does not have a corresponding value in content_localfile.id.
(6 additional frame(s) were not displayed)
...
  File "kolibri_public/management/commands/export_channels_to_kolibri_public.py", line 77, in handle
    self._export_channel(channel_id)
  File "kolibri_public/management/commands/export_channels_to_kolibri_public.py", line 63, in _export_channel
    call_command("migrate", app_label=KolibriContentConfig.label, database=get_active_content_database())

Failed to export channel 6583e111dac85239bb533f26fae6860d to kolibri_public because of error: The row in table 'content_file' with primary key 'c91d3060ca084219ac8eb8eca9d1389c' has an invalid foreign key: content_file.local_file_id contains a value 'local_file_id' that does not have a corresponding value in content_localfile.id.
bjester commented 1 year ago

This occurred while manually running export_channels_to_kolibri_public.py in the hotfixes server environment

bjester commented 1 year ago

Noting this affects 2 channels, which are fairly old. We need to re-publish them, but they have unpublished changes since the last publish, so we need to evaluate them in order to proceed.