初始提交:极码 GeekCode 全栈项目(FastAPI + Vue3)

This commit is contained in:
2026-04-12 10:12:18 +08:00
commit 6aecef16f6
104 changed files with 21009 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
"""附件模型"""
from sqlalchemy import Column, Integer, String, BigInteger, DateTime, ForeignKey
from sqlalchemy.sql import func
from database import Base
class Attachment(Base):
__tablename__ = "attachments"
id = Column(Integer, primary_key=True, index=True)
post_id = Column(Integer, nullable=True, default=None, index=True) # 新建文章时为null发布后回填
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
filename = Column(String(255), nullable=False) # 原始文件名
storage_key = Column(String(500), nullable=False) # COS对象键
url = Column(String(500), nullable=False) # 完整访问URL
file_size = Column(BigInteger, nullable=False) # 文件大小(字节)
file_type = Column(String(100), nullable=False) # MIME类型
created_at = Column(DateTime(timezone=True), server_default=func.now())