# Generated by Django 3.2.6 on 2021-08-24 17:01

from django.db import migrations


def enforce_retain_repo_versions(apps, schema_editor):
    """
    Enforce that all repositories have retain_repo_versions=1
    """

    AnsibleRepository = apps.get_model('ansible', 'AnsibleRepository')

    AnsibleRepository.objects.filter(
        retain_repo_versions=None
    ).update(
        retain_repo_versions=1
    )


class Migration(migrations.Migration):

    dependencies = [
        ('galaxy', '0021_alter_user_first_name'),
    ]

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