# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-11-22 02:02
from __future__ import unicode_literals

import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('iati_vocabulary', '0001_initial'),
        ('contenttypes', '0002_remove_content_type_name'),
        ('iati_codelists', '0001_initial'),
        ('aims', '0047_migrate_total_budget'),
    ]

    operations = [

        # Homebrewed
        migrations.CreateModel(
            name='ResultIndicatorDimension',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dimensions', django.contrib.postgres.fields.ArrayField(base_field=models.TextField(
                    choices=[('gender', 'gender'), ('day', 'day'), ('monthly', 'monthly'), ('quarterly', 'quarterly'),
                             ('yearly', 'yearly')]), blank=True, null=True, size=None)),
                ('stores', models.TextField(choices=[('text', 'Narrative'), ('pc', 'Percent'), ('num', 'Number')],
                                            default='text')),
                ('results', django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True)),
                ('indicator', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicator')),
            ],
        ),

        migrations.CreateModel(
            name='Narrative',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('related_object_id', models.IntegerField(db_index=True, null=True, verbose_name='related object')),
                ('content', models.TextField()),
                ('activity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.Activity')),
                ('language', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.Language')),
                ('related_content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='related_agent', to='contenttypes.ContentType')),
            ],
        ),
        migrations.CreateModel(
            name='ResultDescription',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ResultIndicatorBaselineComment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ResultIndicatorDescription',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ResultIndicatorPeriodActualComment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ResultIndicatorPeriodActualDimension',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('value', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='ResultIndicatorPeriodActualLocation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ref', models.CharField(max_length=50)),
                ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.Location')),
            ],
        ),
        migrations.CreateModel(
            name='ResultIndicatorPeriodTargetComment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ResultIndicatorPeriodTargetDimension',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('value', models.CharField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='ResultIndicatorPeriodTargetLocation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ref', models.CharField(max_length=50)),
                ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.Location')),
            ],
        ),
        migrations.CreateModel(
            name='ResultIndicatorReference',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=255)),
                ('vocabulary_uri', models.URLField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='ResultIndicatorTitle',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('primary_name', models.CharField(blank=True, db_index=True, default='', max_length=255)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ResultTitle',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'abstract': False,
            },
        ),

        migrations.AddField(
            model_name='result',
            name='type',
            field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='iati_codelists.ResultType'),
        ),
        migrations.AddField(
            model_name='resultindicator',
            name='ascending',
            field=models.BooleanField(default=True),
        ),
        migrations.AlterField(
            model_name='result',
            name='activity',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.Activity'),
        ),
        migrations.AlterField(
            model_name='resultindicator',
            name='baseline_value',
            field=models.CharField(blank=True, default=None, max_length=100, null=True),
        ),
        migrations.AlterField(
            model_name='resultindicator',
            name='baseline_year',
            field=models.IntegerField(blank=True, default=None, null=True),
        ),
        migrations.AlterField(
            model_name='resultindicator',
            name='measure',
            field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='iati_codelists.IndicatorMeasure'),
        ),
        migrations.AlterField(
            model_name='resultindicatorperiod',
            name='actual',
            field=models.DecimalField(blank=True, decimal_places=10, max_digits=25, null=True),
        ),
        migrations.AlterField(
            model_name='resultindicatorperiod',
            name='period_end',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name='resultindicatorperiod',
            name='period_start',
            field=models.DateField(blank=True, null=True),
        ),
        migrations.AlterField(
            model_name='resultindicatorperiod',
            name='target',
            field=models.DecimalField(blank=True, decimal_places=10, max_digits=25, null=True),
        ),
        migrations.AddField(
            model_name='resulttitle',
            name='result',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='aims.Result'),
        ),
        migrations.AddField(
            model_name='resultindicatortitle',
            name='result_indicator',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicator'),
        ),
        migrations.AddField(
            model_name='resultindicatorreference',
            name='result_indicator',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicator'),
        ),
        migrations.AddField(
            model_name='resultindicatorreference',
            name='vocabulary',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='iati_vocabulary.IndicatorVocabulary'),
        ),
        migrations.AddField(
            model_name='resultindicatorperiodtargetlocation',
            name='result_indicator_period',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicatorPeriod'),
        ),
        migrations.AddField(
            model_name='resultindicatorperiodtargetdimension',
            name='result_indicator_period',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicatorPeriod'),
        ),
        migrations.AddField(
            model_name='resultindicatorperiodtargetcomment',
            name='result_indicator_period',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicatorPeriod'),
        ),
        migrations.AddField(
            model_name='resultindicatorperiodactuallocation',
            name='result_indicator_period',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicatorPeriod'),
        ),
        migrations.AddField(
            model_name='resultindicatorperiodactualdimension',
            name='result_indicator_period',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicatorPeriod'),
        ),
        migrations.AddField(
            model_name='resultindicatorperiodactualcomment',
            name='result_indicator_period',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicatorPeriod'),
        ),
        migrations.AddField(
            model_name='resultindicatordescription',
            name='result_indicator',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicator'),
        ),
        migrations.AddField(
            model_name='resultindicatorbaselinecomment',
            name='result_indicator',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='aims.ResultIndicator'),
        ),
        migrations.AddField(
            model_name='resultdescription',
            name='result',
            field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='aims.Result'),
        ),
        migrations.AlterIndexTogether(
            name='narrative',
            index_together=set([('related_content_type', 'related_object_id')]),
        ),
    ]
