From dbe57075d386d7474bafc208b654507d9a2d769e Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 6 Nov 2022 13:48:04 -0700 Subject: Rework to a domains model for better vhosting --- users/migrations/0001_initial.py | 93 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 8 deletions(-) (limited to 'users/migrations') diff --git a/users/migrations/0001_initial.py b/users/migrations/0001_initial.py index 5f9eacb..364daaa 100644 --- a/users/migrations/0001_initial.py +++ b/users/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 4.1.3 on 2022-11-05 23:50 +# Generated by Django 4.1.3 on 2022-11-06 19:58 import functools @@ -47,6 +47,30 @@ class Migration(migrations.Migration): "abstract": False, }, ), + migrations.CreateModel( + name="Domain", + fields=[ + ( + "domain", + models.CharField(max_length=250, primary_key=True, serialize=False), + ), + ( + "service_domain", + models.CharField(blank=True, max_length=250, null=True), + ), + ("local", models.BooleanField()), + ("blocked", models.BooleanField(default=False)), + ("public", models.BooleanField()), + ("created", models.DateTimeField(auto_now_add=True)), + ("updated", models.DateTimeField(auto_now=True)), + ( + "users", + models.ManyToManyField( + blank=True, related_name="domains", to=settings.AUTH_USER_MODEL + ), + ), + ], + ), migrations.CreateModel( name="UserEvent", fields=[ @@ -94,10 +118,20 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), - ("handle", models.CharField(max_length=500, unique=True)), + ( + "actor_uri", + models.CharField( + blank=True, max_length=500, null=True, unique=True + ), + ), + ("local", models.BooleanField()), + ("username", models.CharField(blank=True, max_length=500, null=True)), ("name", models.CharField(blank=True, max_length=500, null=True)), ("summary", models.TextField(blank=True, null=True)), - ("actor_uri", models.CharField(blank=True, max_length=500, null=True)), + ( + "manually_approves_followers", + models.BooleanField(blank=True, null=True), + ), ( "profile_uri", models.CharField(blank=True, max_length=500, null=True), @@ -130,17 +164,21 @@ class Migration(migrations.Migration): ), ), ), - ("local", models.BooleanField()), - ( - "manually_approves_followers", - models.BooleanField(blank=True, null=True), - ), ("private_key", models.TextField(blank=True, null=True)), ("public_key", models.TextField(blank=True, null=True)), ("created", models.DateTimeField(auto_now_add=True)), ("updated", models.DateTimeField(auto_now=True)), ("fetched", models.DateTimeField(blank=True, null=True)), ("deleted", models.DateTimeField(blank=True, null=True)), + ( + "domain", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="users.domain", + ), + ), ( "users", models.ManyToManyField( @@ -148,6 +186,10 @@ class Migration(migrations.Migration): ), ), ], + options={ + "verbose_name_plural": "identities", + "unique_together": {("username", "domain")}, + }, ), migrations.CreateModel( name="Follow", @@ -182,4 +224,39 @@ class Migration(migrations.Migration): ), ], ), + migrations.CreateModel( + name="Block", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("mute", models.BooleanField()), + ("expires", models.DateTimeField(blank=True, null=True)), + ("note", models.TextField(blank=True, null=True)), + ("created", models.DateTimeField(auto_now_add=True)), + ("updated", models.DateTimeField(auto_now=True)), + ( + "source", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="outbound_blocks", + to="users.identity", + ), + ), + ( + "target", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="inbound_blocks", + to="users.identity", + ), + ), + ], + ), ] -- cgit v1.2.3