# Generated by Django 4.2.19 on 2025-03-05 15:08

from django.db import migrations


FIX_VALUES = [('True', '1'), ('False', '0')]


def fix_project_star(apps, schema_editor):
    """
    Fix project_star app setting values. Due to an earlier bug, settings were
    set with values "True" and "False" instead of "1" and "0".
    """
    AppSetting = apps.get_model('projectroles', 'AppSetting')
    for v in FIX_VALUES:
        for a in AppSetting.objects.filter(name='project_star', value=v[0]):
            a.value = v[1]
            a.save()


class Migration(migrations.Migration):

    dependencies = [
        ('projectroles', '0033_alter_sodaruseradditionalemail_secret'),
    ]

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