[fix] foreign key dependency
remove unnecessary foreign key undo id
This commit is contained in:
parent
11f9729931
commit
bd5068e73e
3 changed files with 4 additions and 9 deletions
|
@ -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():
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue