-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename fields from "key" to "_key"
We're doing this because "key" is a reserved keyword for MySQL. While Django will escape this for us automatically, we've historically seen downstream tooling break when column names use reserved keywords. Also, it makes things harder for people who are querying the database directly and might not realize that they need to esacape column names. In any event, this has caused enough pain in the past to warrant a check in edx-platform's CI, where it checks column names against a whole list of reserved keywords for several systems: https://github.com/openedx/edx-django-release-util/blob/master/release_util/management/commands/default_reserved_keywords.yml It's likely that we'll want rename at least some of these columns later, but this lets us introduce them into the system without worrying that they'll break anything.
- Loading branch information
Showing
5 changed files
with
68 additions
and
5 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
openedx_learning/core/components/migrations/0002_alter_componentversioncontent_key.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Generated by Django 4.2.10 on 2024-02-14 22:02 | ||
|
||
from django.db import migrations | ||
|
||
import openedx_learning.lib.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('oel_components', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='componentversioncontent', | ||
name='key', | ||
field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
openedx_learning/core/publishing/migrations/0002_alter_learningpackage_key_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 4.2.10 on 2024-02-14 22:02 | ||
|
||
from django.db import migrations | ||
|
||
import openedx_learning.lib.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('oel_publishing', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='learningpackage', | ||
name='key', | ||
field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), | ||
), | ||
migrations.AlterField( | ||
model_name='publishableentity', | ||
name='key', | ||
field=openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, db_column='_key', max_length=500), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters