From e15224ca6945263ea317957288027afab3c9d51b Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 21 Dec 2024 15:23:32 +0100 Subject: [PATCH] feat(migration): Add migration for new block and rule models Introduces EmailBlock, IPBlock, and UsernameRule models with fields for pattern matching, timestamps, and expiration dates. Facilitates blocking and ensuring compliance during registrations. --- .../0005_emailblock_ipblock_usernamerule.py | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/synapse_registration/registration/migrations/0005_emailblock_ipblock_usernamerule.py diff --git a/src/synapse_registration/registration/migrations/0005_emailblock_ipblock_usernamerule.py b/src/synapse_registration/registration/migrations/0005_emailblock_ipblock_usernamerule.py new file mode 100644 index 0000000..db1d3b3 --- /dev/null +++ b/src/synapse_registration/registration/migrations/0005_emailblock_ipblock_usernamerule.py @@ -0,0 +1,68 @@ +# Generated by Django 5.1.3 on 2024-12-21 14:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("registration", "0004_userregistration_mod_message_userregistration_notify"), + ] + + operations = [ + migrations.CreateModel( + name="EmailBlock", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("regex", models.CharField(max_length=1024)), + ("reason", models.TextField(blank=True, null=True)), + ("timestamp", models.DateTimeField(auto_now_add=True)), + ("expires", models.DateTimeField(blank=True, null=True)), + ], + ), + migrations.CreateModel( + name="IPBlock", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("network", models.GenericIPAddressField()), + ("netmask", models.SmallIntegerField(default=-1)), + ("reason", models.TextField(blank=True, null=True)), + ("timestamp", models.DateTimeField(auto_now_add=True)), + ("expires", models.DateTimeField(blank=True, null=True)), + ], + ), + migrations.CreateModel( + name="UsernameRule", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("regex", models.CharField(max_length=1024)), + ("reason", models.TextField(blank=True, null=True)), + ("timestamp", models.DateTimeField(auto_now_add=True)), + ("expires", models.DateTimeField(blank=True, null=True)), + ], + ), + ]