This commit is contained in:
2025-09-21 13:00:10 +02:00
parent a26f8086f8
commit c2a1056db7
56 changed files with 339 additions and 104 deletions

View File

@@ -0,0 +1,35 @@
# 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()