16 lines
452 B
PowerShell
16 lines
452 B
PowerShell
param(
|
|
[string]$Database = $env:ODOO_DATABASE,
|
|
[string]$OutputDir = ".\backups"
|
|
)
|
|
|
|
if (-not $Database) {
|
|
$Database = "Odoo_dance"
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
|
|
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
|
|
$outputFile = Join-Path $OutputDir "$Database`_$timestamp.sql"
|
|
|
|
docker exec odoo_dance_db pg_dump -U odoo $Database | Out-File -Encoding utf8 $outputFile
|
|
Write-Host "Backup created: $outputFile"
|