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

Overview
The ChannelVersion model is a new model in Studio that will allow us to track the channel version history using Django models (until now, we were doing this by looking at the channel.published_data field), and to have relations of other models to specific channel versions.
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 relation, so that we make sure that all published channels have a channel.version_info object set.
Technical details
For this:
- Create a new command on
contentcuration/contentcuration/management/commands/create_channel_versions.py.
- Query all
version>0 Channels (note that we are not using the main_tree.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 present in this object to populate the information of 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
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
The ChannelVersion model is a new model in Studio that will allow us to track the channel version history using Django models (until now, we were doing this by looking at the
channel.published_datafield), and to have relations of other models to specific channel versions.As we will try to make the
ChannelVersionmore 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 thechannel.published_datafield toChannelVersioninstances, and set the propper channel.version_info relation, so that we make sure that all published channels have achannel.version_infoobject set.Technical details
For this:
contentcuration/contentcuration/management/commands/create_channel_versions.py.version>0Channels (note that we are not using themain_tree.publishedfield to support deleted channels).ChannelVersioninstance for each version present in itspublished_datafield. Use the data present in this object to populate the information of theChannelVersioninstance. If, for some reason,published_datais null, then manually create aChannelVersiononly for the current channel version.ChannelVersioninstance as the channelversion_infofield.included_licenses,included_categories,included_languages,non_distributable_licenses_included, orspecial_permissions_included, then:AuditedSpecialPermissionsLicenseobjects, if the channel is public, then set thedistributablefield to true.Acceptance criteria
create_channel_versionscommand is created.version_infofield set.published_dataversions of all channels are now available asChannelVersioninstances.