Files
vibn-frontend/lib
Mark Henderson 2260f3c280 fix(db-introspect): scan all non-template databases, not just $POSTGRES_DB
Coolify exposes a single `postgres_db` per database resource (usually
"postgres"), but the cluster typically holds more than one db inside.
Twenty CRM connects to `default`; our prior query connected to
`postgres` and so reported the database as empty even when Twenty had
hundreds of tables.

Fix:
  - pgListDatabases() enumerates every non-template, connectable db in
    the cluster (`SELECT datname FROM pg_database WHERE datistemplate
    = false AND datallowconn = true`).
  - pgListTables() now unions table listings across all of them.
    Schema is stamped as `<db>.<schema>` only when there's more than
    one db, so single-db clusters keep the bare `public` flatten in
    the UI.
  - pgPreviewTable() understands the dotted `db.schema` form and
    routes the preview `psql` invocation to the correct database.
    Identifier whitelist applied to all three components (db, schema,
    table) before splicing into SQL.

Hard caps unchanged (50 tables total, 8s SSH wall-clock).

Made-with: Cursor
2026-04-29 15:36:28 -07:00
..
2026-02-15 19:25:52 -08:00
2026-02-15 19:25:52 -08:00
2026-02-15 19:25:52 -08:00
2026-02-15 19:25:52 -08:00
2026-02-15 19:25:52 -08:00