first commit
This commit is contained in:
16
app/media/models.py
Normal file
16
app/media/models.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.database.base import Base
|
||||
|
||||
|
||||
class Attachment(Base):
|
||||
__tablename__ = "attachments"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
||||
message_id: Mapped[int] = mapped_column(ForeignKey("messages.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
file_url: Mapped[str] = mapped_column(String(1024), nullable=False)
|
||||
file_type: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
file_size: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
|
||||
message = relationship("Message", back_populates="attachments")
|
||||
Reference in New Issue
Block a user