# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-12-02 19:20
from __future__ import unicode_literals

from django.db import migrations


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0005_dataset_display'),
    ]

    operations = [
        migrations.RunSQL(
            [
                """
                ALTER TABLE api_categorycollection
                  DROP CONSTRAINT api_categorycollection_dataset_id_ef3ff939_fk_api_dataset_id,
                  ADD CONSTRAINT api_categorycollection_dataset_id_ef3ff939_fk_api_dataset_id
                    FOREIGN KEY (dataset_id)
                    REFERENCES api_dataset(id)
                    ON DELETE CASCADE
                    DEFERRABLE INITIALLY DEFERRED;
                """,
                """
                ALTER TABLE api_categorypoint
                  DROP CONSTRAINT api_categor_collection_id_5d302f37_fk_api_categorycollection_id,
                  ADD CONSTRAINT api_categor_collection_id_5d302f37_fk_api_categorycollection_id
                    FOREIGN KEY (collection_id)
                    REFERENCES api_categorycollection(id)
                    ON DELETE CASCADE
                    DEFERRABLE INITIALLY DEFERRED;
                """,
                """
                ALTER TABLE api_numericcollection
                  DROP CONSTRAINT api_numericcollection_dataset_id_55539ea8_fk_api_dataset_id,
                  ADD CONSTRAINT api_numericcollection_dataset_id_55539ea8_fk_api_dataset_id
                    FOREIGN KEY (dataset_id)
                    REFERENCES api_dataset(id)
                    ON DELETE CASCADE
                    DEFERRABLE INITIALLY DEFERRED;
                """,
                """
                ALTER TABLE api_numericpoint
                  DROP CONSTRAINT api_numericp_collection_id_611f1337_fk_api_numericcollection_id,
                  ADD CONSTRAINT api_numericp_collection_id_611f1337_fk_api_numericcollection_id
                    FOREIGN KEY (collection_id)
                    REFERENCES api_numericcollection(id)
                    ON DELETE CASCADE
                    DEFERRABLE INITIALLY DEFERRED;
                """
            ]
        )
    ]

Add ON DELETE CASCADE to more easily remove bad datasets
Add ON DELETE CASCADE to more easily remove bad datasets
