diff --git a/geospaas/catalog/migrations/0008a_add_newparameters_field.py b/geospaas/catalog/migrations/0008a_add_newparameters_field.py new file mode 100644 index 00000000..48c52ae2 --- /dev/null +++ b/geospaas/catalog/migrations/0008a_add_newparameters_field.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.5 on 2019-02-04 18:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('vocabularies', '0001_initial'), + ('catalog', '0007c_remove_source_and_specs_fields'), + ] + + operations = [ + migrations.AddField( + model_name='dataset', + name='newparameters', + field=models.ManyToManyField(to='vocabularies.Parameter'), + ), + ] diff --git a/geospaas/catalog/migrations/0008b_migrate_parameters_data.py b/geospaas/catalog/migrations/0008b_migrate_parameters_data.py new file mode 100644 index 00000000..5560be23 --- /dev/null +++ b/geospaas/catalog/migrations/0008b_migrate_parameters_data.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.5 on 2019-02-05 12:18 + +from django.db import migrations + +def forward(apps, schema_editor): + Dataset = apps.get_model('catalog', 'Dataset') + for ds in Dataset.objects.all(): + ds.newparameters.add(ds.parameters.parameter) + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalog', '0008a_add_newparameters_field'), + ] + + operations = [ + migrations.RunPython(forward, backward), + ] diff --git a/geospaas/catalog/migrations/0008_auto_20190204_1801.py b/geospaas/catalog/migrations/0008c_remove_parameters_field.py similarity index 100% rename from geospaas/catalog/migrations/0008_auto_20190204_1801.py rename to geospaas/catalog/migrations/0008c_remove_parameters_field.py diff --git a/geospaas/catalog/migrations/0009_auto_20190204_1802.py b/geospaas/catalog/migrations/0009_rename_newparameters_field.py similarity index 85% rename from geospaas/catalog/migrations/0009_auto_20190204_1802.py rename to geospaas/catalog/migrations/0009_rename_newparameters_field.py index 02c19e76..cbdf157f 100644 --- a/geospaas/catalog/migrations/0009_auto_20190204_1802.py +++ b/geospaas/catalog/migrations/0009_rename_newparameters_field.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('catalog', '0008_auto_20190204_1801'), + ('catalog', '0008c_remove_parameters_field'), ] operations = [