Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

like image 658
Yuci Avatar asked Jul 29 '18 19:07

Yuci


1 Answers

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.

like image 57
Yuci Avatar answered Oct 31 '22 14:10

Yuci