aboutsummaryrefslogtreecommitdiffstats
path: root/pydis_site/apps/api/migrations
diff options
context:
space:
mode:
authorGravatar mbaruh <[email protected]>2022-11-05 15:20:14 +0200
committerGravatar mbaruh <[email protected]>2022-11-05 15:20:14 +0200
commit649fbc4799082f6ad5d9f986c86ca37ae6fe859d (patch)
tree52e31beaef2bc1654fcf898b6a35e89daaa9627e /pydis_site/apps/api/migrations
parentStop using None as a valid setting value (diff)
Add creation and update timestamps to filtering models
This is to support auto-infractions reporting (bot 7fcec400)
Diffstat (limited to 'pydis_site/apps/api/migrations')
-rw-r--r--pydis_site/apps/api/migrations/0085_new_filter_schema.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/pydis_site/apps/api/migrations/0085_new_filter_schema.py b/pydis_site/apps/api/migrations/0085_new_filter_schema.py
index b0665ba5..d902be7f 100644
--- a/pydis_site/apps/api/migrations/0085_new_filter_schema.py
+++ b/pydis_site/apps/api/migrations/0085_new_filter_schema.py
@@ -60,6 +60,8 @@ def forward(apps: Apps, schema_editor: BaseDatabaseSchemaEditor) -> None:
for object_ in objects:
new_object = filter_.objects.create(
content=object_.content,
+ created_at=object_.created_at,
+ updated_at=object_.updated_at,
filter_list=list_,
description=object_.comment,
additional_field=None,
@@ -99,6 +101,8 @@ class Migration(migrations.Migration):
name='Filter',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
('content', models.CharField(help_text='The definition of this filter.', max_length=100)),
('description', models.CharField(help_text='Why this filter has been added.', max_length=200, null=True)),
('additional_field', models.JSONField(help_text='Implementation specific field.', null=True)),
@@ -125,6 +129,8 @@ class Migration(migrations.Migration):
name='FilterList',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
('name', models.CharField(help_text='The unique name of this list.', max_length=50)),
('list_type', models.IntegerField(choices=[(1, 'Allow'), (0, 'Deny')], help_text='Whether this list is an allowlist or denylist')),
('guild_pings', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=100), help_text='Who to ping when this filter triggers.', size=None)),