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:
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With