# Generated by Django 2.2.24 on 2021-06-10 09:13

from django.db import migrations
from corehq.messaging.smsbackends.turn.models import SQLTurnWhatsAppBackend
from corehq.toggles import TURN_IO_BACKEND


def auto_enable_turnio_ff_for_certain_domains(apps, schema_editor):
    for backend in SQLTurnWhatsAppBackend.active_objects.all():
        domain = backend.domain
        TURN_IO_BACKEND.set(item=domain, enabled=True, namespace='domain')


def noop(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('sms', '0048_delete_sqlicdsbackend'),
    ]

    operations = [
        migrations.RunPython(auto_enable_turnio_ff_for_certain_domains, reverse_code=noop),
    ]

Add migration: auto-enable Turn.io for domains using it
Add migration: auto-enable Turn.io for domains using it
