From da5dbd24f8f427fe3d80065573ee61ab94e1a4c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Oct 2026 21:49:06 -0600 Subject: [PATCH] feat(database): actualizar a sibopay_db con usuario dedicado sibopay_user --- scripts/assign_product_images.js | 2 +- scripts/audit_and_fix_db.js | 2 +- scripts/clean_alergenos.js | 2 +- scripts/deep_audit_all_tables.js | 2 +- scripts/fix_all_database_nulls.js | 2 +- scripts/migrate_sqlite_to_pg.js | 2 +- scripts/seed_new_products.js | 2 +- server/db.js | 2 +- server/pg-worker.js | 2 +- server/server.js | 6 +++--- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/assign_product_images.js b/scripts/assign_product_images.js index a6fd61d..0c0fade 100644 --- a/scripts/assign_product_images.js +++ b/scripts/assign_product_images.js @@ -1,6 +1,6 @@ const { Client } = require('pg'); -const pgUrl = process.env.DATABASE_URL || 'postgresql://postgres:GammaPos2026@127.0.0.1:5432/recreopay_db'; +const pgUrl = process.env.DATABASE_URL || 'postgresql://sibopay_user:SiboPay_Postgres_2026_SecureKey!@127.0.0.1:5432/sibopay_db'; const MAPPING = [ { match: /empanada.*arreglada/i, url: '/img/products/empanada_arreglada.jpg' }, diff --git a/scripts/audit_and_fix_db.js b/scripts/audit_and_fix_db.js index 4ef12ce..1d46fc6 100644 --- a/scripts/audit_and_fix_db.js +++ b/scripts/audit_and_fix_db.js @@ -1,6 +1,6 @@ const { Client } = require('pg'); -const pgUrl = process.env.DATABASE_URL || 'postgresql://postgres:GammaPos2026@127.0.0.1:5432/recreopay_db'; +const pgUrl = process.env.DATABASE_URL || 'postgresql://sibopay_user:SiboPay_Postgres_2026_SecureKey!@127.0.0.1:5432/sibopay_db'; async function runAudit() { const client = new Client({ connectionString: pgUrl }); diff --git a/scripts/clean_alergenos.js b/scripts/clean_alergenos.js index 07980b6..0580505 100644 --- a/scripts/clean_alergenos.js +++ b/scripts/clean_alergenos.js @@ -1,5 +1,5 @@ const { Client } = require('pg'); -const pgUrl = process.env.DATABASE_URL || 'postgresql://postgres:GammaPos2026@127.0.0.1:5432/recreopay_db'; +const pgUrl = process.env.DATABASE_URL || 'postgresql://sibopay_user:SiboPay_Postgres_2026_SecureKey!@127.0.0.1:5432/sibopay_db'; async function run() { const client = new Client({ connectionString: pgUrl }); diff --git a/scripts/deep_audit_all_tables.js b/scripts/deep_audit_all_tables.js index c20e415..701a45b 100644 --- a/scripts/deep_audit_all_tables.js +++ b/scripts/deep_audit_all_tables.js @@ -1,6 +1,6 @@ const { Client } = require('pg'); -const pgUrl = process.env.DATABASE_URL || 'postgresql://postgres:GammaPos2026@127.0.0.1:5432/recreopay_db'; +const pgUrl = process.env.DATABASE_URL || 'postgresql://sibopay_user:SiboPay_Postgres_2026_SecureKey!@127.0.0.1:5432/sibopay_db'; async function deepAudit() { const client = new Client({ connectionString: pgUrl }); diff --git a/scripts/fix_all_database_nulls.js b/scripts/fix_all_database_nulls.js index d97f3b7..bc9e8aa 100644 --- a/scripts/fix_all_database_nulls.js +++ b/scripts/fix_all_database_nulls.js @@ -1,6 +1,6 @@ const { Client } = require('pg'); -const pgUrl = process.env.DATABASE_URL || 'postgresql://postgres:GammaPos2026@127.0.0.1:5432/recreopay_db'; +const pgUrl = process.env.DATABASE_URL || 'postgresql://sibopay_user:SiboPay_Postgres_2026_SecureKey!@127.0.0.1:5432/sibopay_db'; async function fixAllNulls() { const client = new Client({ connectionString: pgUrl }); diff --git a/scripts/migrate_sqlite_to_pg.js b/scripts/migrate_sqlite_to_pg.js index 05fb5c8..3676686 100644 --- a/scripts/migrate_sqlite_to_pg.js +++ b/scripts/migrate_sqlite_to_pg.js @@ -5,7 +5,7 @@ const path = require('path'); const sqlitePath = path.join(__dirname, '..', 'server', 'recreopay.db'); const dbSqlite = new Database(sqlitePath); -const pgUrl = process.env.DATABASE_URL || 'postgresql://postgres:GammaPos2026@127.0.0.1:5432/recreopay_db'; +const pgUrl = process.env.DATABASE_URL || 'postgresql://sibopay_user:SiboPay_Postgres_2026_SecureKey!@127.0.0.1:5432/sibopay_db'; const client = new Client({ connectionString: pgUrl }); async function migrate() { diff --git a/scripts/seed_new_products.js b/scripts/seed_new_products.js index a6384e2..b622f17 100644 --- a/scripts/seed_new_products.js +++ b/scripts/seed_new_products.js @@ -1,6 +1,6 @@ const { Client } = require('pg'); -const pgUrl = process.env.DATABASE_URL || 'postgresql://postgres:GammaPos2026@127.0.0.1:5432/recreopay_db'; +const pgUrl = process.env.DATABASE_URL || 'postgresql://sibopay_user:SiboPay_Postgres_2026_SecureKey!@127.0.0.1:5432/sibopay_db'; const NEW_PRODUCTS = [ // --- 10 COMIDAS Y SNACKS --- diff --git a/server/db.js b/server/db.js index ea3577a..81a26d9 100644 --- a/server/db.js +++ b/server/db.js @@ -97,7 +97,7 @@ if (isPg) { return (...args) => fn(...args); } }; - console.log('🐘 Conectado a PostgreSQL central (recreopay_db)'); + console.log('🐘 Conectado a PostgreSQL central (sibopay_db)'); } else { const Database = require('better-sqlite3'); const dbPath = path.join(__dirname, 'recreopay.db'); diff --git a/server/pg-worker.js b/server/pg-worker.js index aa0855c..35d062c 100644 --- a/server/pg-worker.js +++ b/server/pg-worker.js @@ -9,7 +9,7 @@ types.setTypeParser(1700, (val) => val === null ? null : parseFloat(val)); // nu types.setTypeParser(700, (val) => val === null ? null : parseFloat(val)); // float4 / real types.setTypeParser(701, (val) => val === null ? null : parseFloat(val)); // float8 / double precision -const connectionString = process.env.DATABASE_URL || 'postgresql://postgres:GammaPos2026@127.0.0.1:5432/recreopay_db'; +const connectionString = process.env.DATABASE_URL || 'postgresql://sibopay_user:SiboPay_Postgres_2026_SecureKey!@127.0.0.1:5432/sibopay_db'; const pool = new Pool({ connectionString, diff --git a/server/server.js b/server/server.js index a3331a5..7171939 100644 --- a/server/server.js +++ b/server/server.js @@ -1854,7 +1854,7 @@ app.get('/api/developer/stats', (req, res) => { const totalDisenos = db.prepare('SELECT COUNT(*) as count FROM disenos_tarjetas WHERE activo = 1').get().count; let dbTipo = Boolean(process.env.DATABASE_URL) ? 'PostgreSQL' : 'SQLite'; - let dbDetalle = Boolean(process.env.DATABASE_URL) ? 'PostgreSQL Central (recreopay_db)' : 'WAL Mode Activado'; + let dbDetalle = Boolean(process.env.DATABASE_URL) ? 'PostgreSQL Central (sibopay_db)' : 'WAL Mode Activado'; let dbSizeFormatted = '0 KB'; let dbSizeBytes = 0; @@ -2045,11 +2045,11 @@ async function ejecutarBackupBaseDatos() { const targetPath = path.join(backupsDir, filename); const dbUrl = process.env.DATABASE_URL; const parsed = new URL(dbUrl); - const user = parsed.username || 'postgres'; + const user = parsed.username || 'sibopay_user'; const password = parsed.password || ''; const host = parsed.hostname || '127.0.0.1'; const port = parsed.port || '5432'; - const dbname = parsed.pathname ? parsed.pathname.replace(/^\//, '') : 'recreopay_db'; + const dbname = parsed.pathname ? parsed.pathname.replace(/^\//, '') : 'sibopay_db'; return new Promise((resolve, reject) => { const { exec } = require('child_process');