# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2019-08-02 13:54
from __future__ import unicode_literals

import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import series_tiempo_ar_api.apps.metadata.migrations.enhanced_meta_name_change
import series_tiempo_ar_api.apps.metadata.models


class Migration(migrations.Migration):

    replaces = [('metadata', '0001_initial'), ('metadata', '0002_catalogalias'), ('metadata', 'enhanced_meta_name_change'), ('metadata', '0001_auto_20180810_1220_squashed_0002_auto_20180810_1229'), ('metadata', '0002_auto_20180813_1510'), ('metadata', '0003_metadataconfig'), ('metadata', '0004_auto_20181219_1227'), ('metadata', '0005_auto_20190111_0958'), ('metadata', '0006_auto_20190123_1530'), ('metadata', '0007_remove_metadataconfig_time'), ('metadata', '0008_seriesunits'), ('metadata', '0009_auto_20190301_1204'), ('metadata', '0010_auto_20190408_0958'), ('metadata', '0011_auto_20190613_1103'), ('metadata', '0012_metadataconfig_min_score')]

    initial = True

    dependencies = [
        ('django_datajsonar', '0006_synchronizer_node'),
        ('django_datajsonar', '0010_auto_20180724_1946'),
    ]

    operations = [
        migrations.CreateModel(
            name='IndexMetadataTask',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('status', models.CharField(choices=[('RUNNING', 'Procesando catálogos'), ('FINISHED', 'Finalizada')], max_length=20)),
                ('created', models.DateTimeField()),
                ('finished', models.DateTimeField(null=True)),
                ('logs', models.TextField()),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CatalogAlias',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('alias', models.CharField(max_length=100, validators=[series_tiempo_ar_api.apps.metadata.models.validate_not_catalog_id])),
                ('nodes', models.ManyToManyField(blank=True, to='django_datajsonar.Node')),
            ],
        ),
        migrations.RunPython(
            code=series_tiempo_ar_api.apps.metadata.migrations.enhanced_meta_name_change.migrate_enhanced_meta,
        ),
        migrations.CreateModel(
            name='Synonym',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('terms', models.TextField(help_text='Lista de términos similares, separados por coma, sin espacios ni mayúsculas. Ejemplo "ipc,inflacion"', unique=True)),
            ],
            options={
                'verbose_name': 'Sinónimo de búsqueda',
                'verbose_name_plural': 'Sinónimos de búsqueda',
            },
        ),
        migrations.AlterModelOptions(
            name='catalogalias',
            options={'verbose_name': 'Catalogs alias', 'verbose_name_plural': 'Catalogs Aliases'},
        ),
        migrations.CreateModel(
            name='MetadataConfig',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('query_config', django.contrib.postgres.fields.jsonb.JSONField(default={'dataset_description': {'boost': 1}, 'dataset_source': {'boost': 1}, 'dataset_title': {'boost': 1}, 'description': {'boost': 1.5}})),
                ('min_score', models.FloatField(default=5)),
            ],
            options={
                'abstract': False,
                'verbose_name': 'Configuración de búsqueda de series por metadatos',
            },
        ),
        migrations.AlterField(
            model_name='indexmetadatatask',
            name='created',
            field=models.DateTimeField(auto_now_add=True),
        ),
        migrations.AlterModelOptions(
            name='indexmetadatatask',
            options={'verbose_name': 'Corrida de indexación de metadatos', 'verbose_name_plural': 'Corridas de indexación de metadatos'},
        ),
        migrations.CreateModel(
            name='SeriesUnits',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64, unique=True)),
                ('percentage', models.BooleanField(default=False)),
            ],
            options={
                'verbose_name': 'Unidades de serie',
                'verbose_name_plural': 'Unidades de series',
            },
        ),
        migrations.AddField(
            model_name='indexmetadatatask',
            name='node',
            field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='django_datajsonar.Node'),
        ),
    ]
