Agent Zero AI framework
migration: add overwrite support for .env migration
linuztx5b6fbea1ed81
diff --git a/python/helpers/migration.py b/python/helpers/migration.pyindex b49fe6ac4..ea50c10c2 100644--- a/python/helpers/migration.py+++ b/python/helpers/migration.py@@ -26,7 +26,7 @@ def migrate_user_data() -> None:_move_file("tmp/settings.json", "usr/settings.json")_move_file("tmp/secrets.env", "usr/secrets.env")- _move_file(".env", "usr/.env")+ _move_file(".env", "usr/.env", overwrite=True)# --- Special Migration Cases ---------------------------------------------------@@ -48,19 +48,21 @@ def migrate_user_data() -> None:# --- Helper Functions -----------------------------------------------------------def _move_dir(src: str, dst: str) -> None:+def _move_dir(src: str, dst: str, overwrite: bool = False) -> None:"""Move a directory from src to dst if src exists and dst does not."""- if files.exists(src) and not files.exists(dst):+ if files.exists(src) and (not files.exists(dst) or overwrite):PrintStyle().print(f"Migrating {src} to {dst}...")+ if overwrite and files.exists(dst):+ files.delete_dir(dst)files.move_dir(src, dst)-def _move_file(src: str, dst: str) -> None:+def _move_file(src: str, dst: str, overwrite: bool = False) -> None:"""Move a file from src to dst if src exists and dst does not."""- if files.exists(src) and not files.exists(dst):+ if files.exists(src) and (not files.exists(dst) or overwrite):PrintStyle().print(f"Migrating {src} to {dst}...")files.move_file(src, dst)