@@ -0,0 +1,1390 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Adef fix_gis_data_serialization(apps, schema_editor):%0A    %22%22%22%0A    Release 1.20.0 introduced a change which let the project %22gis_data%22%0A    field get updated by modifications on a scenario.  This effectively%0A    meant that modifications were being applied to all scenarios and that%0A    removing them did not actually remove their effect from the gwlf-e%0A    input.  For projects that were created and suffered from that bug,%0A    clearing out the gis_data on Project and the results on Scenario%0A    will force them to be recomputed with the fix applied.%0A    %22%22%22%0A%0A    Project = apps.get_model('modeling', 'Project')%0A    bug_released_date = '2017-10-17'%0A%0A    # Apply fix to Multi-Year projects created after the release%0A    for project in Project.objects.filter(created_at__gte=bug_released_date,%0A                                          model_package='gwlfe'):%0A        project.gis_data = None%0A        for scenario in project.scenarios.all():%0A            scenario.results = None%0A            scenario.save()%0A%0A        project.save()%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A    dependencies = %5B%0A        ('modeling', '0023_fix_gis_data_serialization'),%0A    %5D%0A%0A    operations = %5B%0A        migrations.RunPython(fix_gis_data_serialization,%0A                             migrations.RunPython.noop)%0A    %5D%0A

Reset models affected by modification bug