maybe good

This commit is contained in:
HotSwapp
2025-08-08 15:55:15 -05:00
parent ab6f163c15
commit b257a06787
80 changed files with 19739 additions and 0 deletions

56
scripts/restore.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
# Restore script for Delphi Database System
set -e
BACKUP_DIR="/app/backups"
DB_FILE="/app/data/delphi_database.db"
echo "🔄 Starting database restore..."
# Check if backup file is provided
if [ -z "$1" ]; then
echo "📋 Available backups:"
ls -la "$BACKUP_DIR"/delphi_backup_*.db 2>/dev/null || echo " No backups found"
echo ""
echo "Usage: $0 <backup_file>"
echo "Example: $0 delphi_backup_20241207_143000.db"
exit 1
fi
BACKUP_FILE="$BACKUP_DIR/$1"
# Check if backup file exists
if [ ! -f "$BACKUP_FILE" ]; then
echo "❌ Backup file not found: $BACKUP_FILE"
echo "📋 Available backups:"
ls -la "$BACKUP_DIR"/delphi_backup_*.db 2>/dev/null || echo " No backups found"
exit 1
fi
# Create backup of current database before restore
if [ -f "$DB_FILE" ]; then
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
CURRENT_BACKUP="${BACKUP_DIR}/delphi_backup_before_restore_${TIMESTAMP}.db"
echo "💾 Creating backup of current database..."
cp "$DB_FILE" "$CURRENT_BACKUP"
echo "✅ Current database backed up to: $CURRENT_BACKUP"
fi
# Restore database
echo "🔄 Restoring database from: $BACKUP_FILE"
cp "$BACKUP_FILE" "$DB_FILE"
# Verify restore
if [ -f "$DB_FILE" ]; then
DB_SIZE=$(stat -f%z "$DB_FILE" 2>/dev/null || stat -c%s "$DB_FILE" 2>/dev/null)
echo "✅ Database restored successfully"
echo " File: $DB_FILE"
echo " Size: $DB_SIZE bytes"
else
echo "❌ Restore failed"
exit 1
fi
echo "🎉 Restore process completed!"
echo "⚠️ Please restart the application to ensure proper database connection."