aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/migrations
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2022-10-01 19:48:25 +0300
committerGravatar mbaruh <[email protected]>2022-10-01 19:48:25 +0300
commit1970a3651db1e1a4f2ef92c85a0a733fa23fa6f0 (patch)
tree39f2254b44519ad8f4e5e21ff6d1fdfeb0500c15 /pydis_site/apps/api/migrations
parentFix send_alert not being added correctly in serializers (diff)
Bring back enabled categories
There needs to be a way to only enable a filter in a specific category, so this setting now fulfills that role. Disabled channels can be used to disable a filter in a specific channel within the category.
Diffstat (limited to 'pydis_site/apps/api/migrations')
-rw-r--r--pydis_site/apps/api/migrations/0084_new_filter_schema.py4
-rw-r--r--pydis_site/apps/api/migrations/0085_unique_constraint_filters.py1
2 files changed, 5 insertions, 0 deletions
diff --git a/pydis_site/apps/api/migrations/0084_new_filter_schema.py b/pydis_site/apps/api/migrations/0084_new_filter_schema.py
index ba228d70..74e1f009 100644
--- a/pydis_site/apps/api/migrations/0084_new_filter_schema.py
+++ b/pydis_site/apps/api/migrations/0084_new_filter_schema.py
@@ -51,6 +51,7 @@ def forward(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None:
disabled_channels=[],
disabled_categories=(["CODE JAM"] if name in ("FILE_FORMAT", "GUILD_INVITE") else []),
enabled_channels=[],
+ enabled_categories=[],
send_alert=(name in ('GUILD_INVITE', 'DOMAIN_NAME', 'FILTER_TOKEN'))
)
@@ -74,6 +75,7 @@ def forward(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None:
disabled_channels=None,
disabled_categories=None,
enabled_channels=None,
+ enabled_categories=None,
send_alert=None,
)
new_object.save()
@@ -111,6 +113,7 @@ class Migration(migrations.Migration):
('disabled_channels', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text="Channels in which to not run the filter.", null=True, size=None)),
('disabled_categories', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text="Categories in which to not run the filter.", null=True, size=None)),
('enabled_channels', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text="Channels in which to run the filter even if it's disabled in the category.", null=True, size=None)),
+ ('enabled_categories', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text="The only categories in which to run the filter.", null=True, size=None)),
('send_alert', models.BooleanField(help_text='Whether an alert should be sent.', null=True)),
],
),
@@ -134,6 +137,7 @@ class Migration(migrations.Migration):
('disabled_channels', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text="Channels in which to not run the filter.", size=None)),
('disabled_categories', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text="Categories in which to not run the filter.", size=None)),
('enabled_channels', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text="Channels in which to run the filter even if it's disabled in the category.", size=None)),
+ ('enabled_categories', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text="The only categories in which to run the filter.", size=None)),
('send_alert', models.BooleanField(help_text='Whether an alert should be sent.')),
],
),
diff --git a/pydis_site/apps/api/migrations/0085_unique_constraint_filters.py b/pydis_site/apps/api/migrations/0085_unique_constraint_filters.py
index 418c6e71..55ede901 100644
--- a/pydis_site/apps/api/migrations/0085_unique_constraint_filters.py
+++ b/pydis_site/apps/api/migrations/0085_unique_constraint_filters.py
@@ -30,6 +30,7 @@ class Migration(migrations.Migration):
'send_alert',
'enabled_channels',
'disabled_channels',
+ 'enabled_categories',
'disabled_categories'
), name='unique_filters'),
),