mirror of
https://github.com/healthchecks/healthchecks.git
synced 2024-11-21 15:17:57 +00:00
26a57343b1
Using model's default didn't quite work, as Django tried to use the same UUID for all rows.
25 lines
594 B
Python
25 lines
594 B
Python
# Generated by Django 5.0.4 on 2024-05-17 07:39
|
|
|
|
from __future__ import annotations
|
|
|
|
import uuid
|
|
from typing import Any
|
|
|
|
from django.apps.registry import Apps
|
|
from django.db import migrations
|
|
|
|
|
|
def fill_code(apps: Apps, schema_editor: Any) -> None:
|
|
Notification = apps.get_model("api", "Notification")
|
|
for n in Notification.objects.filter(code=None):
|
|
n.code = uuid.uuid4()
|
|
n.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("api", "0103_check_badge_key"),
|
|
]
|
|
|
|
operations = [migrations.RunPython(fill_code, migrations.RunPython.noop)]
|