diff --git a/nuxt4/server/api/debug/export-database.post.ts b/nuxt4/server/api/debug/export-database.post.ts index 0f3df7b..eb4d29b 100644 --- a/nuxt4/server/api/debug/export-database.post.ts +++ b/nuxt4/server/api/debug/export-database.post.ts @@ -55,15 +55,9 @@ export default defineEventHandler(async (event) => { const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5) const filename = `backup-seguidordelotes-${timestamp}.sql` - // Ejecutar pg_dump con opciones para máxima compatibilidad - // --clean: incluir DROP antes de CREATE - // --if-exists: usar IF EXISTS en los DROP - // --no-owner: no incluir comandos de ownership - // --no-acl: no incluir permisos - // --no-tablespaces: no incluir tablespaces - // --no-security-labels: no incluir security labels - // --no-synchronized-snapshots: no usar snapshots sincronizados - const command = `PGPASSWORD="${password}" pg_dump -h ${host} -p ${port} -U ${user} -d ${database} --clean --if-exists --no-owner --no-acl --no-tablespaces --no-security-labels --no-synchronized-snapshots` + // Ejecutar pg_dump + // Usar PGPASSWORD en la variable de entorno para evitar prompt de contraseña + const command = `PGPASSWORD="${password}" pg_dump -h ${host} -p ${port} -U ${user} -d ${database} --clean --if-exists --no-owner --no-acl` console.log(' - Ejecutando pg_dump...') const { stdout, stderr } = await execAsync(command, {