summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
22cc421)
- Every database has its own directory
- Every backup file has a timestamp in its filename
& $configMysqldumpCli --host=$configMysqlHost --user=$configMysqlUser --password=$configMysqlPassword --single-transaction --result-file=$target $database
}
& $configMysqldumpCli --host=$configMysqlHost --user=$configMysqlUser --password=$configMysqlPassword --single-transaction --result-file=$target $database
}
+$currDaytime = Get-Date -format "yyyyMMdd-HHmmss"
+
$databases = Get-Databases | Where-Object { $_ -ne "information_schema" -and $_ -ne "performance_schema"}
foreach($d in $databases) {
$databases = Get-Databases | Where-Object { $_ -ne "information_schema" -and $_ -ne "performance_schema"}
foreach($d in $databases) {
- $backupFile = $configBackupDir + "\" + $d + ".sql"
- Write-Output "Backing up $d to $backupFile..."
- Create-Backup $d $backupFile
+ $databaseBackupDir = Join-Path -Path $configBackupDir -ChildPath $d
+
+ if(!(Test-Path $databaseBackupDir)) {
+ New-Item -ItemType directory -Path $databaseBackupDir -ErrorAction Stop | Out-Null
+ }
+
+ $databaseBackupFile = Join-Path -Path $databaseBackupDir -ChildPath "backup-$d-$currDaytime.sql"
+ Write-Output "Backing up $d to $databaseBackupFile..."
+ Create-Backup $d $databaseBackupFile
}
\ No newline at end of file
}
\ No newline at end of file