fix(replicas): parse Prisma DATABASE_URL and dump tables by name

Passwords with @ broke libpq URIs; convert to keyword conninfo.
pg_dump -t public."table" produced empty dumps so replicas stayed at 0.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-18 12:55:39 +03:30
co-authored by Cursor
parent 26630cecf6
commit 1cc5e09b5f
2 changed files with 60 additions and 20 deletions
+3 -4
View File
@@ -10,7 +10,6 @@ postgresql://USER:PASSWORD@SLAVE_2_IP:5432/superadmin"
# Read-only app user on replicas (program-settings API). Grants re-applied after data repair.
# REPLICA_APP_DB_USER=montime
# Publisher DB for pg_dump / count checks. Required when DATABASE_URL password has @
# (Prisma tolerates it; libpq URI parsing breaks → host "Montime@127.0.0.1").
# Use postgres superuser on localhost; URL-encode special chars (@ → %40).
# PUBLISHER_DSN="postgresql://postgres:PASS@127.0.0.1:5432/superadmin"
# Publisher DB. Prefer this if DATABASE_URL password contains @ (must be URL-encoded here).
# Master on montech-01 listens on 15432:
# PUBLISHER_DSN="postgresql://montime:09128081392%40Montime@127.0.0.1:15432/superadmin"