From eeedc39b3edbb960450e07f5bd1e9a7bedb063f4 Mon Sep 17 00:00:00 2001 From: Samuel Walladge Date: Tue, 17 Sep 2019 11:00:17 +0930 Subject: [PATCH] conditionally run migration on CSMH Extended table CSMH_EXTENDED is optional, so this table is not guaranteed to exist. --- lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py b/lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py index dfe8b38c69..4effa24a11 100644 --- a/lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py +++ b/lms/djangoapps/courseware/migrations/0011_csm_id_bigint.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals import courseware.fields +from django.conf import settings from django.db import migrations from django.db.migrations import AlterField @@ -15,7 +16,8 @@ class CsmBigInt(AlterField): def database_forwards(self, app_label, schema_editor, from_state, to_state): to_model = to_state.apps.get_model(app_label, self.model_name) if schema_editor.connection.alias == 'student_module_history': - schema_editor.execute("ALTER TABLE `coursewarehistoryextended_studentmodulehistoryextended` MODIFY `student_module_id` bigint UNSIGNED NOT NULL;") + if settings.FEATURES["ENABLE_CSMH_EXTENDED"]: + schema_editor.execute("ALTER TABLE `coursewarehistoryextended_studentmodulehistoryextended` MODIFY `student_module_id` bigint UNSIGNED NOT NULL;") elif self.allow_migrate_model(schema_editor.connection.alias, to_model): schema_editor.execute("ALTER TABLE `courseware_studentmodule` MODIFY `id` bigint UNSIGNED AUTO_INCREMENT NOT NULL;")