summaryrefslogtreecommitdiffstats
path: root/activities/migrations/0002_fan_out.py
blob: f3b626e2ef6c265dbd677dad9705fd362bb85ff6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# 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,
            },
        ),
    ]