healthchecks_healthchecks/hc/api/migrations/0117_fill_badge_key.py
2024-12-27 12:18:06 +02:00

22 lines
590 B
Python

# Generated by Django 5.1.4 on 2024-12-27 10:07
import uuid
from typing import Any
from django.apps.registry import Apps
from django.db import migrations
def fill_badge_key(apps: Apps, schema_editor: Any) -> None:
Check = apps.get_model("api", "Check")
for c in Check.objects.filter(badge_key=None):
c.badge_key = uuid.uuid4()
c.save(update_fields=["badge_key"])
class Migration(migrations.Migration):
dependencies = [
("api", "0116_alter_check_badge_key"),
]
operations = [migrations.RunPython(fill_badge_key, migrations.RunPython.noop)]