# Generated by Django 2.0.13 on 2019-12-29 21:11

from django.db import migrations
from django.db.migrations import RunPython


def forward(apps, schema):
    Node = apps.get_model("thefederation", "Node")
    for node in Node.objects.filter(host__contains=":"):
        node.host = node.host.split(":")[0]
        if node.name.split(':')[0] == node.host:
            node.name = node.host
        Node.objects.filter(id=node.id).update(host=node.host, name=node.name)


class Migration(migrations.Migration):

    dependencies = [
        ('thefederation', '0019_add_some_defaults_for_node_organization_fields'),
    ]

    operations = [
        RunPython(forward, RunPython.noop)
    ]

# Generated by Django 2.0.13 on 2019-12-29 21:11

from django.db import migrations, IntegrityError
from django.db.migrations import RunPython


def forward(apps, schema):
    Node = apps.get_model("thefederation", "Node")
    for node in Node.objects.filter(host__contains=":"):
        node.host = node.host.split(":")[0]
        if node.name.split(':')[0] == node.host:
            node.name = node.host
        try:
            Node.objects.filter(id=node.id).update(host=node.host, name=node.name)
        except IntegrityError:
            pass


class Migration(migrations.Migration):

    dependencies = [
        ('thefederation', '0019_add_some_defaults_for_node_organization_fields'),
    ]

    operations = [
        RunPython(forward, RunPython.noop)
    ]

Make port removing migrating a bit less flaky
Make port removing migrating a bit less flaky
