Skip to content

Commit

Permalink
#1: ongoing changes to update contents of Dataset.parameters field
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenwh committed Feb 5, 2019
1 parent ebe676a commit a83c862
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
19 changes: 19 additions & 0 deletions geospaas/catalog/migrations/0008a_add_newparameters_field.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
19 changes: 19 additions & 0 deletions geospaas/catalog/migrations/0008b_migrate_parameters_data.py
Original file line number Diff line number Diff line change
@@ -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),
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('catalog', '0008_auto_20190204_1801'),
('catalog', '0008c_remove_parameters_field'),
]

operations = [
Expand Down

0 comments on commit a83c862

Please sign in to comment.