diff options
author | 2023-03-20 14:17:40 +0200 | |
---|---|---|
committer | 2023-03-20 14:17:40 +0200 | |
commit | a1ffabaebe1611ada32e7f3742d4d51fc44484e1 (patch) | |
tree | e07a90e7ffb4840ab3d9e5198ddfa05501591cbe /pydis_site/apps/api/migrations | |
parent | Merge pull request #902 from python-discord/dependabot/pip/flake8-bugbear-23.... (diff) | |
parent | Merge branch 'main' into mbaruh/timeout (diff) |
Merge pull request #897 from python-discord/mbaruh/timeout
Migrate infraction type `mute` to `timeout`
Diffstat (limited to 'pydis_site/apps/api/migrations')
-rw-r--r-- | pydis_site/apps/api/migrations/0087_alter_mute_to_timeout.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pydis_site/apps/api/migrations/0087_alter_mute_to_timeout.py b/pydis_site/apps/api/migrations/0087_alter_mute_to_timeout.py new file mode 100644 index 00000000..8a826ba5 --- /dev/null +++ b/pydis_site/apps/api/migrations/0087_alter_mute_to_timeout.py @@ -0,0 +1,25 @@ +from django.apps.registry import Apps +from django.db import migrations, models + +import pydis_site.apps.api.models + + +def rename_type(apps: Apps, _) -> None: + infractions: pydis_site.apps.api.models.Infraction = apps.get_model("api", "Infraction") + infractions.objects.filter(type="mute").update(type="timeout") + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0086_infraction_jump_url'), + ] + + operations = [ + migrations.AlterField( + model_name='infraction', + name='type', + field=models.CharField(choices=[('note', 'Note'), ('warning', 'Warning'), ('watch', 'Watch'), ('timeout', 'Timeout'), ('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(rename_type, migrations.RunPython.noop) + ] |