@deinossrl/dgp-agent 1.4.57 → 1.4.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/index.mjs +32 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog - DGP Agent
|
|
2
2
|
|
|
3
|
+
## [1.4.58] - 2026-01-12
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Eliminado `--exit-on-error` por defecto en pg_restore
|
|
7
|
+
- Ahora distingue entre errores críticos y warnings de DROP
|
|
8
|
+
- Restauración continúa aunque schemas/objetos no existan previamente
|
|
9
|
+
- pg_restore crea schemas automáticamente según el backup
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Exit code 1 con warnings se considera exitoso si no hay errores críticos
|
|
13
|
+
- Mejores logs que muestran warnings sin fallar la restauración
|
|
14
|
+
|
|
3
15
|
## [1.4.57] - 2026-01-12
|
|
4
16
|
|
|
5
17
|
### Fixed
|
package/index.mjs
CHANGED
|
@@ -2001,10 +2001,9 @@ async function executePgRestore(command) {
|
|
|
2001
2001
|
pgRestoreArgs.push('--if-exists');
|
|
2002
2002
|
}
|
|
2003
2003
|
|
|
2004
|
-
//
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
}
|
|
2004
|
+
// NO usar --exit-on-error por defecto - dejar que pg_restore continúe
|
|
2005
|
+
// Los errores de DROP son normales cuando el objeto no existe
|
|
2006
|
+
// pg_restore luego creará todo lo que necesita
|
|
2008
2007
|
|
|
2009
2008
|
pgRestoreArgs.push('--no-owner');
|
|
2010
2009
|
pgRestoreArgs.push('--no-privileges');
|
|
@@ -2026,12 +2025,38 @@ async function executePgRestore(command) {
|
|
|
2026
2025
|
throw new Error(`Error ejecutando pg_restore: ${result.error.message}`);
|
|
2027
2026
|
}
|
|
2028
2027
|
|
|
2028
|
+
// pg_restore puede retornar exit code 1 con warnings de DROP que son normales
|
|
2029
|
+
// Verificar si es un error crítico o solo warnings
|
|
2029
2030
|
if (result.status !== 0) {
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2031
|
+
const stderr = result.stderr || '';
|
|
2032
|
+
const stdout = result.stdout || '';
|
|
2033
|
+
|
|
2034
|
+
// Errores críticos que deben fallar
|
|
2035
|
+
const criticalErrors = [
|
|
2036
|
+
'could not connect',
|
|
2037
|
+
'authentication failed',
|
|
2038
|
+
'database .* does not exist',
|
|
2039
|
+
'permission denied',
|
|
2040
|
+
'out of memory'
|
|
2041
|
+
];
|
|
2042
|
+
|
|
2043
|
+
const hasCriticalError = criticalErrors.some(pattern =>
|
|
2044
|
+
new RegExp(pattern, 'i').test(stderr) || new RegExp(pattern, 'i').test(stdout)
|
|
2045
|
+
);
|
|
2046
|
+
|
|
2047
|
+
if (hasCriticalError) {
|
|
2048
|
+
throw new Error(`pg_restore failed with critical error: ${stderr}`);
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
// Si no es crítico, es un warning (DROP de objetos inexistentes, etc)
|
|
2052
|
+
logInfo(`Restauración completada con warnings (exit code ${result.status})`);
|
|
2053
|
+
if (stderr) {
|
|
2054
|
+
logInfo(`Warnings: ${stderr.substring(0, 500)}...`);
|
|
2055
|
+
}
|
|
2056
|
+
} else {
|
|
2057
|
+
logSuccess('Restauración completada sin errores');
|
|
2032
2058
|
}
|
|
2033
2059
|
|
|
2034
|
-
logSuccess('Restauración completada');
|
|
2035
2060
|
await addCommandLog('success', 'Base de datos restaurada');
|
|
2036
2061
|
|
|
2037
2062
|
// Actualizar estado en DB
|