-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3008 from SEED-platform/develop
Release 2.12.3 to main branch
- Loading branch information
Showing
42 changed files
with
244 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Generated by Django 3.2.7 on 2021-11-04 23:38 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def forwards(apps, schema_editor): | ||
Column = apps.get_model("seed", "Column") | ||
Organization = apps.get_model("orgs", "Organization") | ||
|
||
columns_to_remove = [ | ||
'analysis_state', 'analysis_state_message', 'analysis_end_time', 'analysis_start_time' | ||
] | ||
|
||
# Go through all the organizations and find all the oclumns to remove. | ||
# There is really no reason to use org.id, but it is there, so doing it that way. | ||
for org in Organization.objects.all(): | ||
for column_to_remove in columns_to_remove: | ||
columns = Column.objects.filter( | ||
organization_id=org.id, | ||
table_name='PropertyState', | ||
column_name=column_to_remove, | ||
is_extra_data=False, | ||
) | ||
|
||
if not columns.count(): | ||
# no column found (should not be the case) | ||
continue | ||
elif columns.count() == 1: | ||
# If the column exists, then just update the display_name and data_type if empty | ||
c = columns.first() | ||
c.delete() | ||
print(f'deleting column {column_to_remove} for org {org.id}') | ||
else: | ||
print(" More than one column returned!") | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('data_importer', '0015_auto_20210712_2134'), | ||
('seed', '0155_propertystate_egrid_subregion_code'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='scenario', | ||
name='analysis_end_time', | ||
), | ||
migrations.RemoveField( | ||
model_name='scenario', | ||
name='analysis_start_time', | ||
), | ||
migrations.RemoveField( | ||
model_name='scenario', | ||
name='analysis_state', | ||
), | ||
migrations.RemoveField( | ||
model_name='scenario', | ||
name='analysis_state_message', | ||
), | ||
migrations.AlterIndexTogether( | ||
name='propertystate', | ||
index_together={('import_file', 'data_state', 'merge_state'), ('import_file', 'data_state', 'source_type'), ('hash_object',), ('import_file', 'data_state')}, | ||
), | ||
migrations.RemoveField( | ||
model_name='propertystate', | ||
name='analysis_end_time', | ||
), | ||
migrations.RemoveField( | ||
model_name='propertystate', | ||
name='analysis_start_time', | ||
), | ||
migrations.RemoveField( | ||
model_name='propertystate', | ||
name='analysis_state', | ||
), | ||
migrations.RemoveField( | ||
model_name='propertystate', | ||
name='analysis_state_message', | ||
), | ||
migrations.RunPython(forwards), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.