# Generated by Django 2.2.13 on 2021-03-19 08:05

from django.db import migrations, models
from django.db.models import F

def update_null(apps, schema_editor):
    Parameter = apps.get_model('measurements', 'Parameter')
    Parameter.objects.filter(code__isnull=True).update(code=F('label'))

class Migration(migrations.Migration):

    dependencies = [
        ('measurements', '0013_auto_20210318_1128'),
    ]

    operations = [
        migrations.RunPython(update_null),
        migrations.AddField(
            model_name='parameter',
            name='unit',
            field=models.CharField(blank=True, help_text='unit of measure based on python-pint unit registry (eg. meter, kelvin)', max_length=25, null=True),
        ),
        migrations.AlterField(
            model_name='parameter',
            name='code',
            field=models.CharField(max_length=100),
        ),
        migrations.AlterField(
            model_name='parameter',
            name='label',
            field=models.CharField(blank=True, max_length=150, null=True),
        ),
        migrations.AlterField(
            model_name='parameter',
            name='uri',
            field=models.URLField(blank=True, help_text='Reference to a controlled vocabulary (eg. NERC)', null=True),
        ),
        migrations.AlterField(
            model_name='parametermapping',
            name='source_parameter_label',
            field=models.CharField(help_text='Parameter label or layer name published by the data provider', max_length=64),
        ),
    ]
