@deinossrl/dgp-agent 1.4.55 → 1.4.57
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 +14 -0
- package/index.mjs +23 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog - DGP Agent
|
|
2
2
|
|
|
3
|
+
## [1.4.57] - 2026-01-12
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Agregado `--if-exists` a pg_restore para evitar errores con DROP de objetos inexistentes
|
|
7
|
+
- `--exit-on-error` ahora solo se usa si skip_errors es false
|
|
8
|
+
- Resuelve error "policy does not exist" durante restore
|
|
9
|
+
|
|
10
|
+
## [1.4.56] - 2026-01-12
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- Ahora verifica que AMBOS ejecutables (`pg_dump.exe` y `pg_restore.exe`) existan
|
|
14
|
+
- Si falta alguno de los dos, reinstala PostgreSQL automáticamente
|
|
15
|
+
- Garantiza que ambas herramientas estén siempre disponibles
|
|
16
|
+
|
|
3
17
|
## [1.4.55] - 2026-01-12
|
|
4
18
|
|
|
5
19
|
### Fixed
|
package/index.mjs
CHANGED
|
@@ -1429,13 +1429,23 @@ async function executeDeploy(command) {
|
|
|
1429
1429
|
async function findOrInstallPgDump() {
|
|
1430
1430
|
const isWindows = process.platform === 'win32';
|
|
1431
1431
|
const executableName = isWindows ? 'pg_dump.exe' : 'pg_dump';
|
|
1432
|
+
const restoreExecutableName = isWindows ? 'pg_restore.exe' : 'pg_restore';
|
|
1432
1433
|
|
|
1433
|
-
// 1. Verificar si ya
|
|
1434
|
+
// 1. Verificar si ya están AMBOS en nuestro BIN_DIR
|
|
1434
1435
|
const localPgDump = join(BIN_DIR, executableName);
|
|
1435
|
-
|
|
1436
|
+
const localPgRestore = join(BIN_DIR, restoreExecutableName);
|
|
1437
|
+
|
|
1438
|
+
if (existsSync(localPgDump) && existsSync(localPgRestore)) {
|
|
1436
1439
|
return localPgDump;
|
|
1437
1440
|
}
|
|
1438
1441
|
|
|
1442
|
+
// Si falta alguno, avisar y continuar con la instalación
|
|
1443
|
+
if (existsSync(localPgDump) && !existsSync(localPgRestore)) {
|
|
1444
|
+
logInfo('pg_dump existe pero falta pg_restore, reinstalando...');
|
|
1445
|
+
} else if (!existsSync(localPgDump) && existsSync(localPgRestore)) {
|
|
1446
|
+
logInfo('pg_restore existe pero falta pg_dump, reinstalando...');
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1439
1449
|
// 2. Buscar en PATH
|
|
1440
1450
|
try {
|
|
1441
1451
|
const checkCmd = isWindows ? 'where pg_dump' : 'which pg_dump';
|
|
@@ -1977,6 +1987,7 @@ async function executePgRestore(command) {
|
|
|
1977
1987
|
// Opciones de restore
|
|
1978
1988
|
if (clean_before_restore) {
|
|
1979
1989
|
pgRestoreArgs.push('--clean');
|
|
1990
|
+
pgRestoreArgs.push('--if-exists'); // Solo borrar si existe (evita errores)
|
|
1980
1991
|
}
|
|
1981
1992
|
|
|
1982
1993
|
if (restore_type === 'schema_only') {
|
|
@@ -1985,8 +1996,16 @@ async function executePgRestore(command) {
|
|
|
1985
1996
|
pgRestoreArgs.push('--data-only');
|
|
1986
1997
|
}
|
|
1987
1998
|
|
|
1988
|
-
//
|
|
1989
|
-
|
|
1999
|
+
// Siempre agregar --if-exists para evitar errores con DROP
|
|
2000
|
+
if (!clean_before_restore) {
|
|
2001
|
+
pgRestoreArgs.push('--if-exists');
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
// Solo detener en errores si skip_errors es false
|
|
2005
|
+
if (!params.skip_errors) {
|
|
2006
|
+
pgRestoreArgs.push('--exit-on-error');
|
|
2007
|
+
}
|
|
2008
|
+
|
|
1990
2009
|
pgRestoreArgs.push('--no-owner');
|
|
1991
2010
|
pgRestoreArgs.push('--no-privileges');
|
|
1992
2011
|
|