# Generated by Django 5.2 on 2026-02-02 14:18

from django.db import migrations


def rename_service_partner_role(apps, schema_editor):
    OrganizationMembership = apps.get_model("api", "OrganizationMembership")
    OrganizationInvite = apps.get_model("api", "OrganizationInvite")

    OrganizationMembership.objects.filter(role="service_partner").update(role="solutions_partner")
    OrganizationInvite.objects.filter(role="service_partner").update(role="solutions_partner")


def reverse_rename_service_partner_role(apps, schema_editor):
    OrganizationMembership = apps.get_model("api", "OrganizationMembership")
    OrganizationInvite = apps.get_model("api", "OrganizationInvite")

    OrganizationMembership.objects.filter(role="solutions_partner").update(role="service_partner")
    OrganizationInvite.objects.filter(role="solutions_partner").update(role="service_partner")


class Migration(migrations.Migration):

    dependencies = [
        ("api", "0278_merge_20260202_1309"),
        ("api", "0277_alter_organizationinvite_role_and_more"),
    ]

    operations = [
        migrations.RunPython(rename_service_partner_role, reverse_rename_service_partner_role),
    ]
