aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/migrations
diff options
context:
space:
mode:
authorGravatar Sebastiaan Zeeff <[email protected]>2019-09-30 12:29:16 +0200
committerGravatar GitHub <[email protected]>2019-09-30 12:29:16 +0200
commit599f4b1523d76f600f19ae1b5f346d683e0183ce (patch)
tree99a76d6169c04468a5dd3194979bd2b64daf1a7f /pydis_site/apps/api/migrations
parentCorrect the Dockerfile path for azure. (diff)
parentMerge branch 'master' into decoupling-warnings-and-notes (diff)
Merge pull request #261 from python-discord/decoupling-warnings-and-notes
Migrate hidden warnings to notes and add additional validation
Diffstat (limited to 'pydis_site/apps/api/migrations')
-rw-r--r--pydis_site/apps/api/migrations/0043_infraction_hidden_warnings_to_notes.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/pydis_site/apps/api/migrations/0043_infraction_hidden_warnings_to_notes.py b/pydis_site/apps/api/migrations/0043_infraction_hidden_warnings_to_notes.py
new file mode 100644
index 00000000..7c751f5d
--- /dev/null
+++ b/pydis_site/apps/api/migrations/0043_infraction_hidden_warnings_to_notes.py
@@ -0,0 +1,23 @@
+# Generated by Django 2.2.5 on 2019-09-25 08:41
+
+from django.db import migrations
+
+
+def migrate_hidden_warnings_to_notes(apps, schema_editor):
+ """Migrates hidden warnings to note."""
+ Infraction = apps.get_model('api', 'Infraction')
+
+ for infraction in Infraction.objects.filter(type="warning", hidden=True):
+ infraction.type = "note"
+ infraction.save()
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0042_infraction_add_default_ordering'),
+ ]
+
+ operations = [
+ migrations.RunPython(migrate_hidden_warnings_to_notes),
+ ]