# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-10-26 18:43
from __future__ import unicode_literals

from django.db import migrations, models

from osf.management.commands.add_notification_subscription import add_reviews_notification_setting
from osf.management.commands.populate_registration_provider_notification_subscriptions import populate_registration_provider_notification_subscriptions


def revert(apps, schema_editor):
    NotificationSubscription = apps.get_model('osf', 'NotificationSubscription')
    # The revert of this migration deletes all NotificationSubscription instances
    NotificationSubscription.objects.filter(provider__isnull=False, provider__type='osf.registrationprovider').delete()


def populate_subscriptions(*args, **kwargs):
    add_reviews_notification_setting('global_reviews')
    populate_registration_provider_notification_subscriptions()


class Migration(migrations.Migration):

    dependencies = [
        ('osf', '0223_auto_20201026_1843'),
    ]

    operations = [
        migrations.AlterField(
            model_name='notificationsubscription',
            name='event_name',
            field=models.CharField(max_length=100),
        ),
        migrations.RunPython(populate_subscriptions, revert)
    ]

# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-10-26 18:43
from __future__ import unicode_literals

from django.db import migrations, models

from osf.management.commands.add_notification_subscription import add_reviews_notification_setting
from osf.management.commands.populate_registration_provider_notification_subscriptions import populate_registration_provider_notification_subscriptions


def revert(apps, schema_editor):
    NotificationSubscription = apps.get_model('osf', 'NotificationSubscription')
    # The revert of this migration deletes all NotificationSubscription instances
    NotificationSubscription.objects.filter(provider__isnull=False, provider__type='osf.registrationprovider').delete()


def populate_subscriptions(*args, **kwargs):
    add_reviews_notification_setting('global_reviews')
    populate_registration_provider_notification_subscriptions()


class Migration(migrations.Migration):

    dependencies = [
        ('osf', '0223_auto_20201026_1843'),
    ]

    operations = [
        migrations.AlterField(
            model_name='notificationsubscription',
            name='event_name',
            field=models.CharField(max_length=100),
        )
    ]

Remove call to run management commands that we didn't use during migration
Remove call to run management commands that we didn't use during migration
