Skip to content

Commit 64d820e

Browse files
kdmccormickclaude
andcommitted
fix(squash): replace SeparateDatabaseAndState+RunSQL with plain AlterField
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f5b6b4b commit 64d820e

1 file changed

Lines changed: 9 additions & 19 deletions

File tree

src/openedx_content/migrations/0012_rename_componentversionmedia_key_to_path.py

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,15 @@ class Migration(migrations.Migration):
2626
new_name='path',
2727
),
2828
# RenameField only changes the Django field name; the DB column is still
29-
# '_key' (set via db_column). Use SeparateDatabaseAndState to rename the
30-
# actual column and drop the db_column override from state.
31-
migrations.SeparateDatabaseAndState(
32-
state_operations=[
33-
migrations.AlterField(
34-
model_name='componentversionmedia',
35-
name='path',
36-
field=openedx_django_lib.fields.MultiCollationCharField(
37-
db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'},
38-
max_length=500,
39-
),
40-
),
41-
],
42-
database_operations=[
43-
migrations.RunSQL(
44-
sql='ALTER TABLE openedx_content_componentversionmedia RENAME COLUMN _key TO path',
45-
reverse_sql='ALTER TABLE openedx_content_componentversionmedia RENAME COLUMN path TO _key',
46-
),
47-
],
29+
# '_key' (set via db_column). AlterField drops db_column, so Django sees
30+
# old column='_key' vs new column='path' and renames it.
31+
migrations.AlterField(
32+
model_name='componentversionmedia',
33+
name='path',
34+
field=openedx_django_lib.fields.MultiCollationCharField(
35+
db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'},
36+
max_length=500,
37+
),
4838
),
4939
migrations.AddConstraint(
5040
model_name='componentversionmedia',

0 commit comments

Comments
 (0)