From 6598ebd27997f9edbfd34d91ac480baccade7d84 Mon Sep 17 00:00:00 2001 From: qasimgulzar Date: Tue, 5 Nov 2024 14:29:47 +0500 Subject: [PATCH] fix: migration issue --- ...oricalpersistentsubsectiongradeoverride.py | 67 +++++++++---------- 1 file changed, 31 insertions(+), 36 deletions(-) diff --git a/lms/djangoapps/grades/migrations/0015_historicalpersistentsubsectiongradeoverride.py b/lms/djangoapps/grades/migrations/0015_historicalpersistentsubsectiongradeoverride.py index 0fbf8d1f5974..8670853f9acf 100644 --- a/lms/djangoapps/grades/migrations/0015_historicalpersistentsubsectiongradeoverride.py +++ b/lms/djangoapps/grades/migrations/0015_historicalpersistentsubsectiongradeoverride.py @@ -1,22 +1,10 @@ # Generated by Django 1.11.20 on 2019-06-05 13:59 -from django.conf import settings -from django.db import migrations, models, connection import django.db.models.deletion import simple_history.models - - -def get_compatible_columns(): - columns = [ - ('grade', - models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, - related_name='+', to='grades.PersistentSubsectionGrade')), - ] - if connection.vendor == 'postgresql': - columns = [('grade_id', models.IntegerField()), ] + columns - - return columns +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): @@ -29,27 +17,34 @@ class Migration(migrations.Migration): migrations.CreateModel( name='HistoricalPersistentSubsectionGradeOverride', fields=[ - ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), - ('created', models.DateTimeField(blank=True, db_index=True, editable=False)), - ('modified', models.DateTimeField(blank=True, db_index=True, editable=False)), - ('earned_all_override', models.FloatField(blank=True, null=True)), - ('possible_all_override', models.FloatField(blank=True, null=True)), - ('earned_graded_override', models.FloatField(blank=True, null=True)), - ('possible_graded_override', models.FloatField(blank=True, null=True)), - ('history_id', models.AutoField(primary_key=True, serialize=False)), - ('history_date', models.DateTimeField()), - ('history_change_reason', models.CharField(max_length=100, null=True)), - ('history_type', - models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), - ('history_user', - models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', - to=settings.AUTH_USER_MODEL)), - ] + get_compatible_columns(), - options={ - 'ordering': ('-history_date', '-history_id'), - 'get_latest_by': 'history_date', - 'verbose_name': 'historical persistent subsection grade override', - }, - bases=(simple_history.models.HistoricalChanges, models.Model), + ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), + ('created', models.DateTimeField(blank=True, db_index=True, editable=False)), + ('modified', models.DateTimeField(blank=True, db_index=True, editable=False)), + ('earned_all_override', models.FloatField(blank=True, null=True)), + ('possible_all_override', models.FloatField(blank=True, null=True)), + ('earned_graded_override', models.FloatField(blank=True, null=True)), + ('possible_graded_override', models.FloatField(blank=True, null=True)), + ('history_id', models.AutoField(primary_key=True, serialize=False)), + ('history_date', models.DateTimeField()), + ('history_change_reason', models.CharField(max_length=100, null=True)), + ('history_type', + models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), + ('history_user', + models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', + to=settings.AUTH_USER_MODEL)), + ], + options = { + 'ordering': ('-history_date', '-history_id'), + 'get_latest_by': 'history_date', + 'verbose_name': 'historical persistent subsection grade override', + }, + bases = (simple_history.models.HistoricalChanges, models.Model), + ), + migrations.AddField( + model_name='historicalpersistentsubsectiongradeoverride', + name='grade', + field=models.ForeignKey(blank=True, db_constraint=False, null=True, + on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', + to='grades.PersistentSubsectionGrade'), ), ]