feat: 扩展多个字符串列为 TEXT 类型并添加 tls-client 可选依赖

数据库迁移:
- 扩展 provider_api_keys.api_key 为 TEXT(OAuth tokens 可能很长)
- 扩展 ldap_configs 的 bind_dn、base_dn、user_search_filter 为 TEXT
- 扩展 oauth_providers.client_id 为 TEXT
- 添加 SQLite 兼容支持(batch 模式)
- 添加表/列存在性检查

依赖:
- 添加 tls-client 作为可选依赖 [tls]
This commit is contained in:
fawney19
2026-02-04 16:45:05 +08:00
parent c996078f30
commit 24c9105628
3 changed files with 104 additions and 25 deletions

View File

@@ -482,12 +482,12 @@ class LDAPConfig(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
server_url = Column(String(255), nullable=False) # ldap://host:389 或 ldaps://host:636
bind_dn = Column(String(255), nullable=False) # 绑定账号 DN
bind_dn = Column(Text, nullable=False) # 绑定账号 DN(可能很长)
bind_password_encrypted = Column(Text, nullable=True) # 加密的绑定密码(允许 NULL 表示已清除)
base_dn = Column(String(255), nullable=False) # 用户搜索基础 DN
base_dn = Column(Text, nullable=False) # 用户搜索基础 DN(可能很长)
user_search_filter = Column(
String(500), default="(uid={username})", nullable=False
) # 用户搜索过滤器
Text, default="(uid={username})", nullable=False
) # 用户搜索过滤器(可能很复杂)
username_attr = Column(
String(50), default="uid", nullable=False
) # 用户名属性 (uid/sAMAccountName)
@@ -548,7 +548,7 @@ class OAuthProvider(Base):
provider_type = Column(String(50), primary_key=True)
display_name = Column(String(100), nullable=False)
client_id = Column(String(255), nullable=False)
client_id = Column(Text, nullable=False) # 某些 OAuth 提供商可能使用很长的 client_id
client_secret_encrypted = Column(Text, nullable=True) # 允许 NULL 表示尚未配置/已清除
# 可选覆盖端点(需在业务层做白名单校验)