← back to Wallco Ai
fix: backfill-wallco-rooms uses sudo -u postgres psql on Linux/prod (root has no PG role; was failing with 'role root does not exist')
fb0b8e2facb4fc8c43247b385fc66ee726f1b84b · 2026-05-30 09:24:34 -0700 · Steve Abrams
Files touched
M scripts/backfill-wallco-rooms.js
Diff
commit fb0b8e2facb4fc8c43247b385fc66ee726f1b84b
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Sat May 30 09:24:34 2026 -0700
fix: backfill-wallco-rooms uses sudo -u postgres psql on Linux/prod (root has no PG role; was failing with 'role root does not exist')
---
scripts/backfill-wallco-rooms.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/backfill-wallco-rooms.js b/scripts/backfill-wallco-rooms.js
index e42afd2..1c92755 100644
--- a/scripts/backfill-wallco-rooms.js
+++ b/scripts/backfill-wallco-rooms.js
@@ -23,8 +23,11 @@ const ROOT = path.resolve(__dirname, '..');
const ROOMS = path.join(ROOT, 'data', 'rooms');
const DRY = process.argv.includes('--dry');
+// On prod (Linux) psql must run as the postgres role — root has no PG role
+// (FATAL: role "root" does not exist). On Mac2 the local user owns dw_unified.
+const PSQL = process.platform === 'linux' ? 'sudo -u postgres psql' : 'psql';
function psql(sql) {
- return execSync(`psql dw_unified -At -F'\x1f' -c ${JSON.stringify(sql)}`, {
+ return execSync(`${PSQL} dw_unified -At -F'\x1f' -c ${JSON.stringify(sql)}`, {
encoding: 'utf8', maxBuffer: 64 * 1024 * 1024,
});
}
← 5f9d9db fix(ui): admin-toolbar no longer overlaps fixed header
·
back to Wallco Ai
·
security: strip hardcoded dw_admin DSN password -> env-first 2d3f9dd →