# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-06-30 15:53


from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('data', '0017_auto_20170623_1934'),
    ]

    operations = [
        migrations.RenameField(
            model_name='report',
            old_name='Minor_allele_frequency_ESP',
            new_name='Minor_allele_frequency_ESP_percent',
        ),
        migrations.RenameField(
            model_name='variant',
            old_name='Minor_allele_frequency_ESP',
            new_name='Minor_allele_frequency_ESP_percent',
        ),
        migrations.RunSQL(
            """
            DROP MATERIALIZED VIEW IF EXISTS currentvariant;
            CREATE MATERIALIZED VIEW currentvariant AS (
                SELECT * FROM "variant" WHERE (
                    "id" IN ( SELECT DISTINCT ON ("Genomic_Coordinate_hg38") "id" FROM "variant" ORDER BY "Genomic_Coordinate_hg38" ASC, "Data_Release_id" DESC )
                )
            );
            """
        ),
    ]
