# Generated by Django 1.11.12 on 2019-09-23 15:12

from django.db import migrations


def migrate_subscribers(apps, schema_editor):
    CartaDSDossier = apps.get_model('cartads_cs', 'CartaDSDossier')
    CartaDSSubscriber = apps.get_model('cartads_cs', 'CartaDSSubscriber')
    for instance in CartaDSDossier.objects.all():
        if instance.name_id:
            subscriber, _ = CartaDSSubscriber.objects.get_or_create(name_id=instance.name_id)
            instance.subscribers.add(subscriber)


class Migration(migrations.Migration):

    dependencies = [
        ('cartads_cs', '0007_auto_20190923_1711'),
    ]

    operations = [
        migrations.RunPython(migrate_subscribers, migrations.RunPython.noop),
    ]
