# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-12-19 15:21
from __future__ import unicode_literals

from django.db import migrations


def remove_accounts(apps, schema_editor):
    PayoutAccount = apps.get_model('payouts', 'PayoutAccount')
    ProjectPhase = apps.get_model('bb_projects', 'ProjectPhase')

    phases = ProjectPhase.objects.filter(
        slug__in=('plan-needs-work', 'plan-submitted', 'plan-new')
    )
    PayoutAccount.objects.filter(project__status__in=phases).delete()


class Migration(migrations.Migration):

    dependencies = [
        ('payouts', '0016_auto_20181215_2016'),
    ]

    operations = [
        migrations.RunPython(remove_accounts)
    ]

Make sure we delete all payoutaccounts from new projects so that they will need submit a stripeaccount.