# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-09-29 11:16
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):
    """
    Due to the magic behind the IATI to AIMS migration, this model
    ends up with a PK to a dead-end table which is dropped.

    This migration drops that problematic relationship and the following migration
    recreates it to the correct model once the other model is in place
    """

    dependencies = [
        ('activity_profile', '0001_initial'),
        ('aims', '0043_iati_to_aims_premove'),
    ]

    operations = [
        migrations.AlterField(
            model_name='activityprofile',
            name='activity',
            field=models.TextField(),
        ),
        # This index would be problematic on the rebuild, it's created auto by the field
        # but not auto dropped on changing the field tyoe causing a "already exists"
        # crash on postgresql
        # Naively assuming that all Hamutuk databases have the same name for the index
        # If not, perhaps add "IF EXISTS" and add another DROP INDEX with the right name
        migrations.RunSQL(
            'DROP INDEX IF EXISTS public.activity_profile_activityprofile_activity_id_7d052fac_like CASCADE;'
        ),
    ]
