# Generated by Django 4.2.9 on 2025-02-02 17:37

from django.db import migrations


def fb_nopause(apps, schema_editor):
    RecurrentImport = apps.get_model("agenda_culturel", "RecurrentImport")

    rimports = RecurrentImport.objects.filter(processor="Facebook events").all()

    for r in rimports:
        r.downloader = "chromium headless"
    
    RecurrentImport.objects.bulk_update(rimports, fields=["downloader"])

def fb_nopause_backward(apps, schema_editor):
    RecurrentImport = apps.get_model("agenda_culturel", "RecurrentImport")

    rimports = RecurrentImport.objects.filter(processor="Facebook events").all()

    for r in rimports:
        r.downloader = "chromium (pause)"
    
    RecurrentImport.objects.bulk_update(rimports, fields=["downloader"])


class Migration(migrations.Migration):

    dependencies = [
        ('agenda_culturel', '0142_alter_recurrentimport_processor'),
    ]

    operations = [
        migrations.RunPython(
            fb_nopause,
            fb_nopause_backward,
        ),
    ]
