# Generated by Codex

from django.db import migrations


def add_google_docs_prefetch(apps, schema_editor):
    """Ensure pipedream prefetch_apps includes google_docs."""
    MCPServerConfig = apps.get_model("api", "MCPServerConfig")

    for cfg in MCPServerConfig.objects.filter(name="pipedream"):
        prefetch = list(cfg.prefetch_apps or [])
        if "google_docs" not in prefetch:
            prefetch.append("google_docs")
            cfg.prefetch_apps = prefetch
            cfg.save(update_fields=["prefetch_apps"])


class Migration(migrations.Migration):

    dependencies = [
        ("api", "0245_contact_can_configure"),
    ]

    operations = [
        migrations.RunPython(add_google_docs_prefetch, migrations.RunPython.noop),
    ]
