migration: Add --backup flag

This commit is contained in:
augustin64 2024-04-10 18:21:06 +02:00
parent 1bd70c8653
commit 52894d37ea

View File

@ -201,11 +201,18 @@ if __name__ == "__main__":
"--restore", "--restore",
help="restore from specific version backup, will not apply any hook (vx.y.z)", help="restore from specific version backup, will not apply any hook (vx.y.z)",
) )
parser.add_argument(
"-b",
"--backup",
help="backup current version, without running any hooks",
)
args = parser.parse_args() args = parser.parse_args()
config.instance = os.path.abspath(args.instance) config.instance = os.path.abspath(args.instance)
if args.restore is None: if args.restore is not None:
migrate(args.current, args.target, skip_backup=args.skip_backup)
else:
restore(args.restore) restore(args.restore)
elif args.backup is not None:
backup_instance(args.backup, verbose=True)
else:
migrate(args.current, args.target, skip_backup=args.skip_backup)