# Generated by Django 2.2.1 on 2019-06-07 15:33

from django.db import migrations


def update_filebeat_releases(apps, schema_editor):
    Enrollment = apps.get_model("filebeat", "Enrollment")
    for enrollment in Enrollment.objects.filter(filebeat_release__gt=""):
        enrollment.filebeat_release = (enrollment.filebeat_release.replace("filebeat-", "")
                                                                  .replace("-darwin-x86_64.tar.gz", ""))
        enrollment.save()


class Migration(migrations.Migration):

    dependencies = [
        ('filebeat', '0003_configuration_inputs'),
    ]

    operations = [
        migrations.RunPython(update_filebeat_releases),
    ]
