Skip to content

Commit 86bb7b3

Browse files
committed
refactor: remove UUID field from ComponentVersionContent
It's wasteful to have a UUID on this join table, as we already have a unique way to address everything in it by the unique combination of the ComponentVersion (PublishableEntityVersion) and the ComponentVersionContent.key (file path). Dropping this column may cause transient errors for some sites if someone is creating components after the column was dropped, but before the new app code is live. UUIDs are generated on the Python side, so Django will try to generate a UUID to put into a column that has already been dropped on the database side. That being said, this window of time should be small, and this feature is not in widespread use yet. I don't think a more complex migration is warranted.
1 parent 2644032 commit 86bb7b3

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.2.23 on 2025-10-02 14:00
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('oel_components', '0003_remove_componentversioncontent_learner_downloadable'),
10+
]
11+
12+
operations = [
13+
migrations.RemoveField(
14+
model_name='componentversioncontent',
15+
name='uuid',
16+
),
17+
]

‎openedx_learning/apps/authoring/components/models.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from django.db import models
2323

24-
from ....lib.fields import case_sensitive_char_field, immutable_uuid_field, key_field
24+
from ....lib.fields import case_sensitive_char_field, key_field
2525
from ....lib.managers import WithRelationsManager
2626
from ..contents.models import Content
2727
from ..publishing.models import LearningPackage, PublishableEntityMixin, PublishableEntityVersionMixin
@@ -240,8 +240,6 @@ class ComponentVersionContent(models.Model):
240240
component_version = models.ForeignKey(ComponentVersion, on_delete=models.CASCADE)
241241
content = models.ForeignKey(Content, on_delete=models.RESTRICT)
242242

243-
uuid = immutable_uuid_field()
244-
245243
# "key" is a reserved word for MySQL, so we're temporarily using the column
246244
# name of "_key" to avoid breaking downstream tooling. A possible
247245
# alternative name for this would be "path", since it's most often used as

0 commit comments

Comments
 (0)