db/update models
This commit is contained in:
parent
b7ecc4728b
commit
1233ca6050
2 changed files with 6 additions and 4 deletions
|
@ -31,6 +31,7 @@ def upgrade() -> None:
|
||||||
sa.Column('ap_context', sa.String(), nullable=True),
|
sa.Column('ap_context', sa.String(), nullable=True),
|
||||||
sa.Column('ap_published_at', sa.DateTime(timezone=True), nullable=False),
|
sa.Column('ap_published_at', sa.DateTime(timezone=True), nullable=False),
|
||||||
sa.Column('ap_object', sa.JSON(), nullable=False),
|
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('visibility', sa.Enum('PUBLIC', 'UNLISTED', 'FOLLOWERS_ONLY', 'DIRECT', name='visibilityenum'), nullable=False),
|
||||||
sa.Column('relates_to_inbox_object_id', sa.Integer(), nullable=True),
|
sa.Column('relates_to_inbox_object_id', sa.Integer(), nullable=True),
|
||||||
sa.Column('relates_to_outbox_object_id', sa.Integer(), nullable=True),
|
sa.Column('relates_to_outbox_object_id', sa.Integer(), nullable=True),
|
||||||
|
@ -41,6 +42,7 @@ def upgrade() -> None:
|
||||||
)
|
)
|
||||||
op.create_index(op.f('ix_inbox_ap_id'), 'inbox', ['ap_id'], unique=True)
|
op.create_index(op.f('ix_inbox_ap_id'), 'inbox', ['ap_id'], unique=True)
|
||||||
op.create_index(op.f('ix_inbox_ap_type'), 'inbox', ['ap_type'], unique=False)
|
op.create_index(op.f('ix_inbox_ap_type'), 'inbox', ['ap_type'], unique=False)
|
||||||
|
op.create_index(op.f('ix_inbox_activity_object_ap_id'), 'inbox', ['activity_object_ap_id'], unique=False)
|
||||||
op.create_index(op.f('ix_inbox_id'), 'inbox', ['id'], unique=False)
|
op.create_index(op.f('ix_inbox_id'), 'inbox', ['id'], unique=False)
|
||||||
op.create_table('outbox',
|
op.create_table('outbox',
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
sa.Column('id', sa.Integer(), nullable=False),
|
||||||
|
|
|
@ -61,6 +61,7 @@ class InboxObject(Base):
|
||||||
ap_context = Column(String, nullable=True)
|
ap_context = Column(String, nullable=True)
|
||||||
ap_published_at = Column(DateTime(timezone=True), nullable=False)
|
ap_published_at = Column(DateTime(timezone=True), nullable=False)
|
||||||
ap_object: Mapped[dict[str, Any]] = Column(JSON, nullable=False) # type: ignore
|
ap_object: Mapped[dict[str, Any]] = Column(JSON, nullable=False) # type: ignore
|
||||||
|
activity_object_ap_id = Column(String, nullable=True, index=True)
|
||||||
|
|
||||||
visibility = Column(Enum(ap.VisibilityEnum), nullable=False)
|
visibility = Column(Enum(ap.VisibilityEnum), nullable=False)
|
||||||
|
|
||||||
|
@ -71,7 +72,7 @@ class InboxObject(Base):
|
||||||
)
|
)
|
||||||
relates_to_inbox_object: Mapped[Optional["InboxObject"]] = relationship(
|
relates_to_inbox_object: Mapped[Optional["InboxObject"]] = relationship(
|
||||||
"InboxObject",
|
"InboxObject",
|
||||||
foreign_keys=relates_to_inbox_object_id,
|
foreign_keys=[relates_to_inbox_object_id],
|
||||||
remote_side=id,
|
remote_side=id,
|
||||||
uselist=False,
|
uselist=False,
|
||||||
)
|
)
|
||||||
|
@ -82,8 +83,7 @@ class InboxObject(Base):
|
||||||
)
|
)
|
||||||
relates_to_outbox_object: Mapped[Optional["OutboxObject"]] = relationship(
|
relates_to_outbox_object: Mapped[Optional["OutboxObject"]] = relationship(
|
||||||
"OutboxObject",
|
"OutboxObject",
|
||||||
foreign_keys=[relates_to_outbox_object_id],
|
foreign_keys=relates_to_outbox_object_id,
|
||||||
remote_side=id,
|
|
||||||
uselist=False,
|
uselist=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class OutboxObject(Base):
|
||||||
)
|
)
|
||||||
relates_to_inbox_object: Mapped[Optional["InboxObject"]] = relationship(
|
relates_to_inbox_object: Mapped[Optional["InboxObject"]] = relationship(
|
||||||
"InboxObject",
|
"InboxObject",
|
||||||
foreign_keys=[relates_to_inbox_object_id],
|
foreign_keys=relates_to_inbox_object_id,
|
||||||
uselist=False,
|
uselist=False,
|
||||||
)
|
)
|
||||||
relates_to_outbox_object_id = Column(
|
relates_to_outbox_object_id = Column(
|
||||||
|
|
Loading…
Reference in a new issue