diff options
author | 2023-03-04 20:04:41 +0200 | |
---|---|---|
committer | 2023-03-04 20:04:41 +0200 | |
commit | 548131617b93482c9591e4d5b9ebe78aed36d88b (patch) | |
tree | 04e09126028e0958490b550aecf67e7f8d467c50 /pydis_site/apps/api/migrations | |
parent | Merge pull request #894 from python-discord/dependabot/pip/pre-commit-3.1.1 (diff) |
Migrate infraction type `mute` to `timeout`
Diffstat (limited to 'pydis_site/apps/api/migrations')
-rw-r--r-- | pydis_site/apps/api/migrations/0086_alter_mute_to_timeout.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pydis_site/apps/api/migrations/0086_alter_mute_to_timeout.py b/pydis_site/apps/api/migrations/0086_alter_mute_to_timeout.py new file mode 100644 index 00000000..8eb3ff6d --- /dev/null +++ b/pydis_site/apps/api/migrations/0086_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', '0085_add_thread_id_to_nominations'), + ] + + 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) + ] |