diff --git a/alembic/env.py b/alembic/env.py index 6ef7031..69e1151 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -70,7 +70,8 @@ def run_migrations_online() -> None: with connectable.connect() as connection: context.configure( - connection=connection, target_metadata=target_metadata + connection=connection, target_metadata=target_metadata, + render_as_batch=True, ) with context.begin_transaction(): 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 9e4e91b..8b05095 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 @@ -33,12 +33,10 @@ 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=True), 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'], ), - sa.ForeignKeyConstraint(['undo_id'], ['inbox.id'], ), sa.ForeignKeyConstraint(['relates_to_inbox_object_id'], ['inbox.id'], ), sa.ForeignKeyConstraint(['relates_to_outbox_object_id'], ['outbox.id'], ), sa.PrimaryKeyConstraint('id') @@ -59,7 +57,6 @@ 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=True), sa.Column('is_deleted', sa.Boolean(), nullable=False), sa.Column('likes_count', sa.Integer(), nullable=False), sa.Column('announces_count', sa.Integer(), nullable=False), @@ -68,7 +65,6 @@ 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 d02125d..79b2006 100644 --- a/app/models.py +++ b/app/models.py @@ -66,7 +66,6 @@ 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, @@ -81,7 +80,7 @@ class InboxObject(Base): ) relates_to_outbox_object_id = Column( Integer, - ForeignKey("outbox.id"), + ForeignKey("outbox.id", use_alter=True), nullable=True, ) relates_to_outbox_object: Mapped[Optional["OutboxObject"]] = relationship( @@ -109,7 +108,6 @@ 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) @@ -117,7 +115,7 @@ class OutboxObject(Base): relates_to_inbox_object_id = Column( Integer, - ForeignKey("inbox.id"), + ForeignKey("inbox.id", use_alter=True), nullable=True, ) relates_to_inbox_object: Mapped[Optional["InboxObject"]] = relationship(