from sqlalchemy import Column, Integer, String, DateTime from sqlalchemy.sql import text from database import Base class CompanyR2Config(Base): __tablename__ = "company_r2_configs" id = Column(Integer, primary_key=True, index=True, comment='主键 ID') company_code = Column(String(50), nullable=False, unique=True, index=True, comment='公司编码,唯一') r2_account_id = Column(String(200), nullable=False, server_default="", comment='R2 账户 ID') r2_access_key_id = Column(String(200), nullable=False, server_default="", comment='R2 访问密钥 ID') r2_secret_access_key = Column(String(200), nullable=False, server_default="", comment='R2 密钥') r2_bucket_name = Column(String(200), nullable=False, server_default="", comment='R2 桶名称') r2_public_url = Column(String(500), nullable=False, server_default="", comment='R2 公共访问 URL') r2_enabled = Column(Integer, nullable=False, server_default="1", comment='是否启用 R2:0-禁用,1-启用') created_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP'), comment='创建时间') updated_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), comment='更新时间')