mirror of
https://github.com/healthchecks/healthchecks.git
synced 2024-11-21 15:17:57 +00:00
25 lines
679 B
Python
25 lines
679 B
Python
# Generated by Django 2.1.3 on 2018-11-20 20:04
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from typing import Any
|
|
|
|
from django.apps.registry import Apps
|
|
from django.db import migrations
|
|
|
|
|
|
def combine_channel_names(apps: Apps, schema_editor: Any) -> None:
|
|
Channel = apps.get_model("api", "Channel")
|
|
for channel in Channel.objects.filter(kind="sms"):
|
|
if channel.value.startswith("{"):
|
|
doc = json.loads(channel.value)
|
|
channel.name = doc.get("label", "")
|
|
channel.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [("api", "0043_channel_name")]
|
|
|
|
operations = [migrations.RunPython(combine_channel_names)]
|