diff --git a/alembic/versions/2023_03_19_1509-caf39c6e55fc_in_out_models.py b/alembic/versions/2023_03_19_1509-caf39c6e55fc_in_out_models.py index e526d36..77dc666 100644 --- a/alembic/versions/2023_03_19_1509-caf39c6e55fc_in_out_models.py +++ b/alembic/versions/2023_03_19_1509-caf39c6e55fc_in_out_models.py @@ -34,6 +34,7 @@ def upgrade() -> None: sa.Column('activity_object_ap_id', sa.String(), nullable=True), sa.Column('visibility', sa.Enum('PUBLIC', 'UNLISTED', 'FOLLOWERS_ONLY', 'DIRECT', name='visibilityenum'), nullable=False), sa.Column('undo_id', sa.Integer(), nullable=False), + sa.Column('is_deleted', sa.Boolean(), nullable=False), sa.Column('relates_to_inbox_object_id', sa.Integer(), nullable=True), sa.Column('relates_to_outbox_object_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['actor_id'], ['actor.id'], ), @@ -58,6 +59,8 @@ def upgrade() -> None: sa.Column('ap_object', sa.JSON(), nullable=False), sa.Column('activity_object_ap_id', sa.String(), nullable=True), sa.Column('visibility', sa.Enum('PUBLIC', 'UNLISTED', 'FOLLOWERS_ONLY', 'DIRECT', name='visibilityenum'), nullable=False), + sa.Column('undo_id', sa.Integer(), nullable=False), + sa.Column('is_deleted', sa.Boolean(), nullable=False), sa.Column('likes_count', sa.Integer(), nullable=False), sa.Column('announces_count', sa.Integer(), nullable=False), sa.Column('replies_count', sa.Integer(), nullable=False), @@ -65,6 +68,7 @@ def upgrade() -> None: sa.Column('relates_to_outbox_object_id', sa.Integer(), nullable=True), sa.Column('relates_to_actor_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['relates_to_actor_id'], ['actor.id'], ), + sa.ForeignKeyConstraint(['undo_id'], ['outbox.id'], ), sa.ForeignKeyConstraint(['relates_to_inbox_object_id'], ['inbox.id'], ), sa.ForeignKeyConstraint(['relates_to_outbox_object_id'], ['outbox.id'], ), sa.PrimaryKeyConstraint('id') diff --git a/app/models.py b/app/models.py index 1d53035..13af1ae 100644 --- a/app/models.py +++ b/app/models.py @@ -66,6 +66,7 @@ class InboxObject(Base): visibility = Column(Enum(ap.VisibilityEnum), nullable=False) undo_id = Column(Integer, ForeignKey("inbox.id"), nullable=True) + is_deleted = Column(Boolean, nullable=False, default=False) relates_to_inbox_object_id = Column( Integer, ForeignKey("inbox.id"), @@ -107,6 +108,8 @@ class OutboxObject(Base): visibility = Column(Enum(ap.VisibilityEnum), nullable=False) + undo_id = Column(Integer, ForeignKey("inbox.id"), nullable=True) + is_deleted = Column(Boolean, nullable=False, default=False) likes_count = Column(Integer, nullable=False, default=0) announces_count = Column(Integer, nullable=False, default=0) replies_count: Mapped[int] = Column(Integer, nullable=False, default=0) #type: ignore