summaryrefslogtreecommitdiffstats
path: root/activities/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'activities/migrations')
-rw-r--r--activities/migrations/0001_initial.py239
-rw-r--r--activities/migrations/0002_fan_out.py103
-rw-r--r--activities/migrations/0003_alter_post_object_uri.py18
-rw-r--r--activities/migrations/0004_rename_authored_post_published_alter_fanout_type_and_more.py126
-rw-r--r--activities/migrations/0005_post_hashtags_alter_fanout_type_and_more.py48
-rw-r--r--activities/migrations/0006_alter_post_hashtags.py18
-rw-r--r--activities/migrations/0007_post_edited.py18
-rw-r--r--activities/migrations/0008_postattachment.py69
-rw-r--r--activities/migrations/0009_alter_postattachment_file.py28
9 files changed, 229 insertions, 438 deletions
diff --git a/activities/migrations/0001_initial.py b/activities/migrations/0001_initial.py
index 0b350ef..19f3026 100644
--- a/activities/migrations/0001_initial.py
+++ b/activities/migrations/0001_initial.py
@@ -1,9 +1,16 @@
-# Generated by Django 4.1.3 on 2022-11-11 20:02
+# Generated by Django 4.1.3 on 2022-11-18 17:49
+
+import functools
import django.db.models.deletion
+import django.utils.timezone
from django.db import migrations, models
+import activities.models.fan_out
import activities.models.post
+import activities.models.post_attachment
+import activities.models.post_interaction
+import core.uploads
import stator.models
@@ -42,7 +49,12 @@ class Migration(migrations.Migration):
),
),
("local", models.BooleanField()),
- ("object_uri", models.CharField(blank=True, max_length=500, null=True)),
+ (
+ "object_uri",
+ models.CharField(
+ blank=True, max_length=500, null=True, unique=True
+ ),
+ ),
(
"visibility",
models.IntegerField(
@@ -63,26 +75,222 @@ class Migration(migrations.Migration):
"in_reply_to",
models.CharField(blank=True, max_length=500, null=True),
),
+ ("hashtags", models.JSONField(blank=True, null=True)),
+ ("published", models.DateTimeField(default=django.utils.timezone.now)),
+ ("edited", models.DateTimeField(blank=True, null=True)),
("created", models.DateTimeField(auto_now_add=True)),
("updated", models.DateTimeField(auto_now=True)),
(
"author",
models.ForeignKey(
on_delete=django.db.models.deletion.PROTECT,
- related_name="statuses",
+ related_name="posts",
to="users.identity",
),
),
(
"mentions",
models.ManyToManyField(
- related_name="posts_mentioning", to="users.identity"
+ blank=True, related_name="posts_mentioning", to="users.identity"
),
),
(
"to",
models.ManyToManyField(
- related_name="posts_to", to="users.identity"
+ blank=True, related_name="posts_to", to="users.identity"
+ ),
+ ),
+ ],
+ options={
+ "abstract": False,
+ },
+ ),
+ migrations.CreateModel(
+ name="PostInteraction",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("state_ready", models.BooleanField(default=True)),
+ ("state_changed", models.DateTimeField(auto_now_add=True)),
+ ("state_attempted", models.DateTimeField(blank=True, null=True)),
+ ("state_locked_until", models.DateTimeField(blank=True, null=True)),
+ (
+ "state",
+ stator.models.StateField(
+ choices=[
+ ("new", "new"),
+ ("fanned_out", "fanned_out"),
+ ("undone", "undone"),
+ ("undone_fanned_out", "undone_fanned_out"),
+ ],
+ default="new",
+ graph=activities.models.post_interaction.PostInteractionStates,
+ max_length=100,
+ ),
+ ),
+ (
+ "object_uri",
+ models.CharField(
+ blank=True, max_length=500, null=True, unique=True
+ ),
+ ),
+ (
+ "type",
+ models.CharField(
+ choices=[("like", "Like"), ("boost", "Boost")], max_length=100
+ ),
+ ),
+ ("published", models.DateTimeField(default=django.utils.timezone.now)),
+ ("created", models.DateTimeField(auto_now_add=True)),
+ ("updated", models.DateTimeField(auto_now=True)),
+ (
+ "identity",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="interactions",
+ to="users.identity",
+ ),
+ ),
+ (
+ "post",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="interactions",
+ to="activities.post",
+ ),
+ ),
+ ],
+ options={
+ "index_together": {("type", "identity", "post")},
+ },
+ ),
+ migrations.CreateModel(
+ name="PostAttachment",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("state_ready", models.BooleanField(default=True)),
+ ("state_changed", models.DateTimeField(auto_now_add=True)),
+ ("state_attempted", models.DateTimeField(blank=True, null=True)),
+ ("state_locked_until", models.DateTimeField(blank=True, null=True)),
+ (
+ "state",
+ stator.models.StateField(
+ choices=[("new", "new"), ("fetched", "fetched")],
+ default="new",
+ graph=activities.models.post_attachment.PostAttachmentStates,
+ max_length=100,
+ ),
+ ),
+ ("mimetype", models.CharField(max_length=200)),
+ (
+ "file",
+ models.FileField(
+ blank=True,
+ null=True,
+ upload_to=functools.partial(
+ core.uploads.upload_namer, *("attachments",), **{}
+ ),
+ ),
+ ),
+ ("remote_url", models.CharField(blank=True, max_length=500, null=True)),
+ ("name", models.TextField(blank=True, null=True)),
+ ("width", models.IntegerField(blank=True, null=True)),
+ ("height", models.IntegerField(blank=True, null=True)),
+ ("focal_x", models.IntegerField(blank=True, null=True)),
+ ("focal_y", models.IntegerField(blank=True, null=True)),
+ ("blurhash", models.TextField(blank=True, null=True)),
+ (
+ "post",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="attachments",
+ to="activities.post",
+ ),
+ ),
+ ],
+ options={
+ "abstract": False,
+ },
+ ),
+ migrations.CreateModel(
+ name="FanOut",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("state_ready", models.BooleanField(default=True)),
+ ("state_changed", models.DateTimeField(auto_now_add=True)),
+ ("state_attempted", models.DateTimeField(blank=True, null=True)),
+ ("state_locked_until", models.DateTimeField(blank=True, null=True)),
+ (
+ "state",
+ stator.models.StateField(
+ choices=[("new", "new"), ("sent", "sent")],
+ default="new",
+ graph=activities.models.fan_out.FanOutStates,
+ max_length=100,
+ ),
+ ),
+ (
+ "type",
+ models.CharField(
+ choices=[
+ ("post", "Post"),
+ ("interaction", "Interaction"),
+ ("undo_interaction", "Undo Interaction"),
+ ],
+ max_length=100,
+ ),
+ ),
+ ("created", models.DateTimeField(auto_now_add=True)),
+ ("updated", models.DateTimeField(auto_now=True)),
+ (
+ "identity",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="fan_outs",
+ to="users.identity",
+ ),
+ ),
+ (
+ "subject_post",
+ models.ForeignKey(
+ blank=True,
+ null=True,
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="fan_outs",
+ to="activities.post",
+ ),
+ ),
+ (
+ "subject_post_interaction",
+ models.ForeignKey(
+ blank=True,
+ null=True,
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="fan_outs",
+ to="activities.postinteraction",
),
),
],
@@ -107,10 +315,11 @@ class Migration(migrations.Migration):
models.CharField(
choices=[
("post", "Post"),
- ("mention", "Mention"),
- ("like", "Like"),
- ("follow", "Follow"),
("boost", "Boost"),
+ ("mentioned", "Mentioned"),
+ ("liked", "Liked"),
+ ("followed", "Followed"),
+ ("boosted", "Boosted"),
],
max_length=100,
),
@@ -140,15 +349,25 @@ class Migration(migrations.Migration):
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
- related_name="timeline_events_about_us",
+ related_name="timeline_events",
to="activities.post",
),
),
+ (
+ "subject_post_interaction",
+ models.ForeignKey(
+ blank=True,
+ null=True,
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="timeline_events",
+ to="activities.postinteraction",
+ ),
+ ),
],
options={
"index_together": {
- ("identity", "type", "subject_post", "subject_identity"),
("identity", "type", "subject_identity"),
+ ("identity", "type", "subject_post", "subject_identity"),
},
},
),
diff --git a/activities/migrations/0002_fan_out.py b/activities/migrations/0002_fan_out.py
deleted file mode 100644
index f3b626e..0000000
--- a/activities/migrations/0002_fan_out.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-12 05:36
-
-import django.db.models.deletion
-import django.utils.timezone
-from django.db import migrations, models
-
-import activities.models.fan_out
-import stator.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ("users", "0001_initial"),
- ("activities", "0001_initial"),
- ]
-
- operations = [
- migrations.AddField(
- model_name="post",
- name="authored",
- field=models.DateTimeField(default=django.utils.timezone.now),
- ),
- migrations.AlterField(
- model_name="post",
- name="author",
- field=models.ForeignKey(
- on_delete=django.db.models.deletion.PROTECT,
- related_name="posts",
- to="users.identity",
- ),
- ),
- migrations.AlterField(
- model_name="post",
- name="mentions",
- field=models.ManyToManyField(
- blank=True, related_name="posts_mentioning", to="users.identity"
- ),
- ),
- migrations.AlterField(
- model_name="post",
- name="to",
- field=models.ManyToManyField(
- blank=True, related_name="posts_to", to="users.identity"
- ),
- ),
- migrations.CreateModel(
- name="FanOut",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- ("state_ready", models.BooleanField(default=True)),
- ("state_changed", models.DateTimeField(auto_now_add=True)),
- ("state_attempted", models.DateTimeField(blank=True, null=True)),
- ("state_locked_until", models.DateTimeField(blank=True, null=True)),
- (
- "state",
- stator.models.StateField(
- choices=[("new", "new"), ("sent", "sent")],
- default="new",
- graph=activities.models.fan_out.FanOutStates,
- max_length=100,
- ),
- ),
- (
- "type",
- models.CharField(
- choices=[("post", "Post"), ("boost", "Boost")], max_length=100
- ),
- ),
- ("created", models.DateTimeField(auto_now_add=True)),
- ("updated", models.DateTimeField(auto_now=True)),
- (
- "identity",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- related_name="fan_outs",
- to="users.identity",
- ),
- ),
- (
- "subject_post",
- models.ForeignKey(
- blank=True,
- null=True,
- on_delete=django.db.models.deletion.CASCADE,
- related_name="fan_outs",
- to="activities.post",
- ),
- ),
- ],
- options={
- "abstract": False,
- },
- ),
- ]
diff --git a/activities/migrations/0003_alter_post_object_uri.py b/activities/migrations/0003_alter_post_object_uri.py
deleted file mode 100644
index 4f98bc9..0000000
--- a/activities/migrations/0003_alter_post_object_uri.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-13 03:09
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ("activities", "0002_fan_out"),
- ]
-
- operations = [
- migrations.AlterField(
- model_name="post",
- name="object_uri",
- field=models.CharField(blank=True, max_length=500, null=True, unique=True),
- ),
- ]
diff --git a/activities/migrations/0004_rename_authored_post_published_alter_fanout_type_and_more.py b/activities/migrations/0004_rename_authored_post_published_alter_fanout_type_and_more.py
deleted file mode 100644
index 7972f18..0000000
--- a/activities/migrations/0004_rename_authored_post_published_alter_fanout_type_and_more.py
+++ /dev/null
@@ -1,126 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-14 00:41
-
-import django.db.models.deletion
-import django.utils.timezone
-from django.db import migrations, models
-
-import activities.models.post_interaction
-import stator.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ("users", "0002_identity_public_key_id"),
- ("activities", "0003_alter_post_object_uri"),
- ]
-
- operations = [
- migrations.RenameField(
- model_name="post",
- old_name="authored",
- new_name="published",
- ),
- migrations.AlterField(
- model_name="fanout",
- name="type",
- field=models.CharField(
- choices=[("post", "Post"), ("interaction", "Interaction")],
- max_length=100,
- ),
- ),
- migrations.AlterField(
- model_name="timelineevent",
- name="subject_post",
- field=models.ForeignKey(
- blank=True,
- null=True,
- on_delete=django.db.models.deletion.CASCADE,
- related_name="timeline_events",
- to="activities.post",
- ),
- ),
- migrations.CreateModel(
- name="PostInteraction",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- ("state_ready", models.BooleanField(default=True)),
- ("state_changed", models.DateTimeField(auto_now_add=True)),
- ("state_attempted", models.DateTimeField(blank=True, null=True)),
- ("state_locked_until", models.DateTimeField(blank=True, null=True)),
- (
- "state",
- stator.models.StateField(
- choices=[("new", "new"), ("fanned_out", "fanned_out")],
- default="new",
- graph=activities.models.post_interaction.PostInteractionStates,
- max_length=100,
- ),
- ),
- (
- "object_uri",
- models.CharField(
- blank=True, max_length=500, null=True, unique=True
- ),
- ),
- (
- "type",
- models.CharField(
- choices=[("like", "Like"), ("boost", "Boost")], max_length=100
- ),
- ),
- ("published", models.DateTimeField(default=django.utils.timezone.now)),
- ("created", models.DateTimeField(auto_now_add=True)),
- ("updated", models.DateTimeField(auto_now=True)),
- (
- "identity",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- related_name="interactions",
- to="users.identity",
- ),
- ),
- (
- "post",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- related_name="interactions",
- to="activities.post",
- ),
- ),
- ],
- options={
- "index_together": {("type", "identity", "post")},
- },
- ),
- migrations.AddField(
- model_name="fanout",
- name="subject_post_interaction",
- field=models.ForeignKey(
- blank=True,
- null=True,
- on_delete=django.db.models.deletion.CASCADE,
- related_name="fan_outs",
- to="activities.postinteraction",
- ),
- ),
- migrations.AddField(
- model_name="timelineevent",
- name="subject_post_interaction",
- field=models.ForeignKey(
- blank=True,
- null=True,
- on_delete=django.db.models.deletion.CASCADE,
- related_name="timeline_events",
- to="activities.postinteraction",
- ),
- ),
- ]
diff --git a/activities/migrations/0005_post_hashtags_alter_fanout_type_and_more.py b/activities/migrations/0005_post_hashtags_alter_fanout_type_and_more.py
deleted file mode 100644
index 07d5cca..0000000
--- a/activities/migrations/0005_post_hashtags_alter_fanout_type_and_more.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-16 20:18
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- (
- "activities",
- "0004_rename_authored_post_published_alter_fanout_type_and_more",
- ),
- ]
-
- operations = [
- migrations.AddField(
- model_name="post",
- name="hashtags",
- field=models.JSONField(default=[]),
- ),
- migrations.AlterField(
- model_name="fanout",
- name="type",
- field=models.CharField(
- choices=[
- ("post", "Post"),
- ("interaction", "Interaction"),
- ("undo_interaction", "Undo Interaction"),
- ],
- max_length=100,
- ),
- ),
- migrations.AlterField(
- model_name="timelineevent",
- name="type",
- field=models.CharField(
- choices=[
- ("post", "Post"),
- ("boost", "Boost"),
- ("mentioned", "Mentioned"),
- ("liked", "Liked"),
- ("followed", "Followed"),
- ("boosted", "Boosted"),
- ],
- max_length=100,
- ),
- ),
- ]
diff --git a/activities/migrations/0006_alter_post_hashtags.py b/activities/migrations/0006_alter_post_hashtags.py
deleted file mode 100644
index b6149ea..0000000
--- a/activities/migrations/0006_alter_post_hashtags.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-17 04:18
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ("activities", "0005_post_hashtags_alter_fanout_type_and_more"),
- ]
-
- operations = [
- migrations.AlterField(
- model_name="post",
- name="hashtags",
- field=models.JSONField(blank=True, null=True),
- ),
- ]
diff --git a/activities/migrations/0007_post_edited.py b/activities/migrations/0007_post_edited.py
deleted file mode 100644
index d4a661f..0000000
--- a/activities/migrations/0007_post_edited.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-17 04:50
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ("activities", "0006_alter_post_hashtags"),
- ]
-
- operations = [
- migrations.AddField(
- model_name="post",
- name="edited",
- field=models.DateTimeField(blank=True, null=True),
- ),
- ]
diff --git a/activities/migrations/0008_postattachment.py b/activities/migrations/0008_postattachment.py
deleted file mode 100644
index 168ed58..0000000
--- a/activities/migrations/0008_postattachment.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-17 05:42
-
-import django.db.models.deletion
-from django.db import migrations, models
-
-import activities.models.post_attachment
-import stator.models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ("activities", "0007_post_edited"),
- ]
-
- operations = [
- migrations.CreateModel(
- name="PostAttachment",
- fields=[
- (
- "id",
- models.BigAutoField(
- auto_created=True,
- primary_key=True,
- serialize=False,
- verbose_name="ID",
- ),
- ),
- ("state_ready", models.BooleanField(default=True)),
- ("state_changed", models.DateTimeField(auto_now_add=True)),
- ("state_attempted", models.DateTimeField(blank=True, null=True)),
- ("state_locked_until", models.DateTimeField(blank=True, null=True)),
- (
- "state",
- stator.models.StateField(
- choices=[("new", "new"), ("fetched", "fetched")],
- default="new",
- graph=activities.models.post_attachment.PostAttachmentStates,
- max_length=100,
- ),
- ),
- ("mimetype", models.CharField(max_length=200)),
- (
- "file",
- models.FileField(
- blank=True, null=True, upload_to="attachments/%Y/%m/%d/"
- ),
- ),
- ("remote_url", models.CharField(blank=True, max_length=500, null=True)),
- ("name", models.TextField(blank=True, null=True)),
- ("width", models.IntegerField(blank=True, null=True)),
- ("height", models.IntegerField(blank=True, null=True)),
- ("focal_x", models.IntegerField(blank=True, null=True)),
- ("focal_y", models.IntegerField(blank=True, null=True)),
- ("blurhash", models.TextField(blank=True, null=True)),
- (
- "post",
- models.ForeignKey(
- on_delete=django.db.models.deletion.CASCADE,
- related_name="attachments",
- to="activities.post",
- ),
- ),
- ],
- options={
- "abstract": False,
- },
- ),
- ]
diff --git a/activities/migrations/0009_alter_postattachment_file.py b/activities/migrations/0009_alter_postattachment_file.py
deleted file mode 100644
index 0a250c3..0000000
--- a/activities/migrations/0009_alter_postattachment_file.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Generated by Django 4.1.3 on 2022-11-18 01:40
-
-import functools
-
-from django.db import migrations, models
-
-import core.uploads
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ("activities", "0008_postattachment"),
- ]
-
- operations = [
- migrations.AlterField(
- model_name="postattachment",
- name="file",
- field=models.FileField(
- blank=True,
- null=True,
- upload_to=functools.partial(
- core.uploads.upload_namer, *("attachments",), **{}
- ),
- ),
- ),
- ]