aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/migrations/0074_voice_mute.py
blob: f43156df9342a68dea9150d8eca517cd2b53bc67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Generated by Django 3.0.14 on 2021-10-09 18:52
from django.apps.registry import Apps
from django.db import migrations, models
from django.db.backends.base.schema import BaseDatabaseSchemaEditor


def migrate_infractions(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None:
    Infraction = apps.get_model("api", "Infraction")

    for infraction in Infraction.objects.filter(type="voice_ban"):
        infraction.type = "voice_mute"
        infraction.save()


def unmigrate_infractions(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None:
    Infraction = apps.get_model("api", "Infraction")

    for infraction in Infraction.objects.filter(type="voice_mute"):
        infraction.type = "voice_ban"
        infraction.save()


class Migration(migrations.Migration):

    dependencies = [
        ('api', '0073_otn_allow_GT_and_LT'),
    ]

    operations = [
        migrations.AlterField(
            model_name='infraction',
            name='type',
            field=models.CharField(choices=[('note', 'Note'), ('warning', 'Warning'), ('watch', 'Watch'), ('mute', 'Mute'), ('kick', 'Kick'), ('ban', 'Ban'), ('superstar', 'Superstar'), ('voice_ban', 'Voice Ban'), ('voice_mute', 'Voice Mute')], help_text='The type of the infraction.', max_length=10),
        ),
        migrations.RunPython(migrate_infractions, unmigrate_infractions, elidable=True)
    ]