feat: 数据库迁移前自动备份 (#6360)

This commit is contained in:
InfinityPacer
2026-08-19 18:35:56 +08:00
committed by GitHub
parent f700db5ac8
commit 2b3766e86e
12 changed files with 495 additions and 58 deletions
+2
View File
@@ -194,6 +194,8 @@ class ConfigModel(BaseModel):
DB_BACKUP_ENABLE: bool = False
# 定时备份的 Cron 表达式,留空时不注册定时任务
DB_BACKUP_CRON: str = "0 3 * * *"
# 检测到现有数据库需要迁移时,在结构变更前创建恢复点
DB_BACKUP_ON_UPGRADE: bool = True
# 备份根目录;未配置时使用 CONFIG_PATH/database_backup
DB_BACKUP_PATH: Optional[str] = None
# 本地备份的保留天数,0 表示不按时间清理