fix s3 storage
This commit is contained in:
@@ -13,7 +13,9 @@ class Attachment(Base):
|
||||
__tablename__ = "attachments"
|
||||
__table_args__ = (
|
||||
CheckConstraint("size_bytes BETWEEN 1 AND 10485760", name="size_bytes"),
|
||||
CheckConstraint("content_type IN ('image/png', 'image/jpeg')", name="content_type"),
|
||||
CheckConstraint(
|
||||
"content_type IN ('image/png', 'image/jpeg')", name="content_type"
|
||||
),
|
||||
CheckConstraint("sha256 ~ '^[a-f0-9]{64}$'", name="sha256"),
|
||||
CheckConstraint("status = 'ready'", name="status"),
|
||||
Index("ix_attachments_chat_id", "chat_id"),
|
||||
@@ -35,8 +37,12 @@ class Attachment(Base):
|
||||
class MessageAttachment(Base):
|
||||
__tablename__ = "message_attachments"
|
||||
|
||||
message_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("messages.id", ondelete="CASCADE"), primary_key=True)
|
||||
attachment_id: Mapped[uuid.UUID] = mapped_column(ForeignKey("attachments.id"), primary_key=True)
|
||||
message_id: Mapped[uuid.UUID] = mapped_column(
|
||||
ForeignKey("messages.id", ondelete="CASCADE"), primary_key=True
|
||||
)
|
||||
attachment_id: Mapped[uuid.UUID] = mapped_column(
|
||||
ForeignKey("attachments.id"), primary_key=True
|
||||
)
|
||||
position: Mapped[int]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user