Skip to content

ESoCC: Create migration command to create ChannelVersion models for old channels #5593

@AlexVelezLl

Description

@AlexVelezLl

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

Overview

As we will try to make the ChannelVersion more of a standard for querying channel version information in the future, we will need to migrate all the data that we already have stored in the channel.published_data field to ChannelVersion instances, and set the propper channel.version_info object, so that we make sure that all published channels have a channel.version_info object set.

For this:

  • Query all version>0 Channels (note that we are not using the published field to support deleted channels).
  • Iterate through the channels using the .iterator() method to prevent loading all channels at once. For each channel:
    • Create a ChannelVersion instance for each version present in its published_data field. Use the data set in this object to populate the information in the ChannelVersion instance. If, for some reason, published_data is null, then manually create a ChannelVersion only for the current channel version.
    • Only for the current version of the channel:
      • Set the created ChannelVersion instance as the channel version_info field.
      • If any of the following fields are missing: included_licenses, included_categories, included_languages, non_distributable_licenses_included, or special_permissions_included, then:
        • Load the content database of that channel
        • Compute all these properties. Try to reuse as much code as possible from the current fill_published_fields method.
        • When creating the AuditedSpecialPermissionsLicense objects, if the channel is public, then set the distributable field to true.

Acceptance criteria

  • All channels with a version > 0 should have their version_info field set.
  • All published_data versions of all channels are now available in ChannelVersion instances.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions