sequelize-auto TypeError: connection.query(...).on is not a function

6.4k Views Asked by At

I tried to use sequelize-auto to automatically generate models from existing PostgreSQL tables for SequelizeJS.

npm install -g sequelize-auto pg
sequelize-auto -o "./models" -d myDatabase -h localhost -u myUsername -p 5432 -x myPassword -e postgres

However, it failed with error TypeError: connection.query(...).on is not a function

Note: I'm using the following library versions:

1

There are 1 best solutions below

0
Yuci On BEST ANSWER

It looks like that query.on has been removed from pg version 7.

The workaround for now is to downgrade pg to version 6, e.g., 6.4.2

npm install -g [email protected]

Then sequelize-auto (of the latest version 0.4.29 for the time being) would work fine.