feat: 数据库迁移前自动备份 - #6360
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目标
在现有数据库确实存在待执行迁移时,于任何建表或 Alembic 结构变更前创建并校验备份,避免迁移失败后缺少可恢复制品。
主要改动
DB_BACKUP_ON_UPGRADE,默认开启,并继续受DB_BACKUP_ENABLE总开关控制。create_all或 Alembic。兼容性
DB_BACKUP_ENABLE=false时保持既有启动行为,不启用定时备份或迁移前备份。验证
5040 passed, 3 skipped。22 passed。10.00/10。pg_restore --list校验、迁移成功及缺少pg_dump时中止迁移。git diff --check通过。前端配置入口:jxxghp/MoviePilot-Frontend#687。后端可独立合并并通过环境变量使用该配置。