# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2017-04-03 18:49
from __future__ import unicode_literals

from django.db import migrations
from django.db.models import Q


def forwards(apps, schema_editor):
    # find which columns are not used in column mappings
    ColumnMapping = apps.get_model("seed", "ColumnMapping")

    # delete any empty column mappings
    cms = ColumnMapping.objects.filter(Q(column_raw=None) | Q(column_mapped=None))
    for cm in cms:
        cm.delete()


class Migration(migrations.Migration):
    dependencies = [
        ('seed', '0057_remove_column_extra_data_source'),
    ]

    operations = [
        migrations.RunPython(forwards),
    ]
