File size: 489 Bytes
0f336cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from datetime import datetime, timezone
import os
import shutil


class BackupEngine:
    """Generates timestamped database file backups."""

    @staticmethod
    def perform_backup(db_path: str = "spark_colony.db") -> str:
        backup_filename = f"spark_colony_backup_{datetime.now(timezone.utc).strftime('%Y%m%d_%H%M%S')}.db"
        if os.path.exists(db_path):
            shutil.copy(db_path, backup_filename)
            return backup_filename
        return "DATABASE_NOT_FOUND"