paulelie / winston-pg-native

A Winston 3.X transport for PostgreSQL. Uses high performance of native bindings.
MIT License
17 stars 5 forks source link

Question: working with non-public schema #5

Open jfavrod opened 4 years ago

jfavrod commented 4 years ago

I created the table for the winston-pg-notive to push to in a schema named logs. The tableName is winston, example below:

CREATE SCHEMA logs;

CREATE TABLE logs.winston (
  timestamp timestamp without time zone DEFAULT now(),
  level character varying,
  message character varying,
  meta json
);

When configured to work with this table, I receive the following error:

(node:93692) UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('Error: relation "logs.winston" does not exist\n    at module.exports.Client._emitResult (/Users/jfavr1/dev/labor-calendar/service/node_modules/pg-native/index.js:173:26)\n    at module.exports.Client._read (/Users/jfavr1/dev/labor-calendar/service/node_modules/pg-native/index.js:215:31)\n    at PQ.emit (events.js:198:13)')
... logging output omitted ...

I created a new table in the public schema called logs with the same description of the logs.winston table. I updated the configuration to use the logs table, and it worked.

Can PostgreSQL Transport class be configured to work with schemas besides public?

danilomourelle commented 1 year ago

Have you tried to set the schema to connection string?

Like postgresql://<user>:<pass>@localhost:5432/<database>?schema=logs