# scripts/backup_database.py """Simple backup for early development.""" import os import shutil from datetime import datetime from pathlib import Path def backup_current_db(): """Quick backup of current database.""" db_path = "ecommerce.db" if not os.path.exists(db_path): print("ℹ️ No existing database found - nothing to backup") return # Create backup directory backup_dir = Path("backups") backup_dir.mkdir(exist_ok=True) # Create timestamped backup timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") backup_path = backup_dir / f"ecommerce_pre_reset_{timestamp}.db" try: shutil.copy2(db_path, backup_path) print(f"✅ Database backed up to: {backup_path}") except Exception as e: print(f"⚠️ Backup failed: {e}") if __name__ == "__main__": backup_current_db()