mirror of
https://github.com/healthchecks/healthchecks.git
synced 2024-11-24 16:26:49 +00:00
30 lines
748 B
Python
30 lines
748 B
Python
# Generated by Django 4.2.5 on 2023-09-11 13:06
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from typing import Any
|
|
|
|
from django.apps.registry import Apps
|
|
from django.db import migrations
|
|
|
|
|
|
def normalize_opsgenie_values(apps: Apps, schema_editor: Any) -> None:
|
|
Channel = apps.get_model("api", "Channel")
|
|
for ch in Channel.objects.filter(kind="opsgenie").only("value"):
|
|
if ch.value.startswith("{"):
|
|
continue
|
|
|
|
ch.value = json.dumps({"key": ch.value, "region": "us"})
|
|
ch.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("api", "0099_alter_channel_disabled"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(normalize_opsgenie_values, migrations.RunPython.noop)
|
|
]
|