Skip to content

Commit 163f28d

Browse files
feanilclaude
andcommitted
refactor: migrate ENABLE_CSMH_EXTENDED off FEATURES-as-dict in the CSM bigint migration
ENABLE_CSMH_EXTENDED is a flat setting (openedx/envs/common.py, default True); its app readers (courseware/models.py) and tests already use settings.ENABLE_CSMH_EXTENDED. The 2019 0011_csm_id_bigint data migration still read settings.FEATURES["ENABLE_CSMH_EXTENDED"] in two places: - the Migration class body, evaluated at import time (on every migrate / makemigrations / test-DB build), gating an extra dependency; and - database_forwards(), gating the studentmodulehistoryextended ALTER TABLE. Switch both to bare settings.ENABLE_CSMH_EXTENDED, matching models.py. Behavior is identical, and reading the flat setting keeps the migration working for the deployments that still apply it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9117254 commit 163f28d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def database_forwards(self, app_label, schema_editor, from_state, to_state):
2121
to_model = to_state.apps.get_model(app_label, self.model_name)
2222

2323
if schema_editor.connection.alias == 'student_module_history':
24-
if settings.FEATURES["ENABLE_CSMH_EXTENDED"]:
24+
if settings.ENABLE_CSMH_EXTENDED:
2525
if schema_editor.connection.vendor == 'mysql':
2626
schema_editor.execute("ALTER TABLE `coursewarehistoryextended_studentmodulehistoryextended` MODIFY `student_module_id` bigint UNSIGNED NOT NULL;")
2727
elif schema_editor.connection.vendor == 'postgresql':
@@ -45,7 +45,7 @@ class Migration(migrations.Migration):
4545
('courseware', '0010_auto_20190709_1559'),
4646
]
4747

48-
if settings.FEATURES["ENABLE_CSMH_EXTENDED"]:
48+
if settings.ENABLE_CSMH_EXTENDED:
4949
dependencies.append(('coursewarehistoryextended', '0002_force_studentmodule_index'))
5050

5151
operations = [

0 commit comments

Comments
 (0)