Skip to content

Publish file sizes into both legacy and 64-bit content database columns #5987

Description

@rtibbles

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Studio can now store files larger than 2.1 GB (#5974). But publish still exports only the legacy 32-bit LocalFile.file_size, which cannot represent them. This adds a 64-bit file_size_bigint column to the exported content database, populated at publish. New Kolibri (learningequality/kolibri#14881) reads the true size; old Kolibri keeps reading the legacy column. Ships with the merged included_presets change (#6004) in the same content-schema hotfix.

Complexity: Low
Target branch: hotfixes

Context

  • Studio generates the content database through the vendored kolibri_content schema (base_models.py).
  • create_associated_file_objects (publish.py:644) writes LocalFile rows through those models.
  • The export already advertises content schema VERSION_6, set by the merged included_presets change (Publish a renderer-preset bitmask (File.included_presets) into the content database #6004).
  • This issue adds file_size_bigint into that schema — no further version bump.
  • MIN_SCHEMA_VERSION stays "1" (publish.py:67), so old Kolibri still imports.
  • Kolibri's VERSION_6 import (Widen LocalFile.file_size to BigIntegerField for content > 2.1 GB kolibri#14881) reads LocalFile.file_size_bigint directly.
  • Pre-VERSION_6 exports have their legacy file_size mapped into it instead.
  • file_size_bigint is a LocalFile column only.
  • Kolibri does not read a bigint size on File.
  • Both the kolibri_content export mirror and the kolibri_public API mirror derive from base_models.LocalFile.

The Change

  • Add a nullable file_size_bigint BigIntegerField to LocalFile in base_models.py, keeping the legacy file_size.
  • Migrate both mirrors: kolibri_content/0025_* and kolibri_public/0010_*.
  • In create_associated_file_objects (publish.py:661), set file_size_bigint to the real size on every LocalFile.
  • Set the legacy file_size to the real size when it fits in 32 bits, else NULL.

Out of Scope

Acceptance Criteria

General

  • LocalFile in the export models carries a nullable file_size_bigint alongside the legacy file_size.
  • Both the kolibri_content and kolibri_public mirrors migrate the new column.
  • A channel with a >2.1 GB file imports into current Kolibri with the full size, and into pre-VERSION_6 Kolibri with NULL for that file's size.

Testing

  • Publishing a file ≤2.1 GB writes the same value to file_size and file_size_bigint.
  • Publishing a file >2.1 GB writes the real value to file_size_bigint and NULL to file_size.
  • The exported database imports into current Kolibri with the full size populated.

References

AI usage

I used Claude (Opus 4.8, via le-skills:writing-github-issues) to draft this issue against the merged included_presets export (#6004) and the Kolibri counterpart (#14881). The design was mine; Claude mapped the code and wrote it up.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions