I am building a nodejs API with PostgreSQL & Sequilize. My client gave me a .sql file which has been exported from dbdiagram.io.
Is it possible to generate all my models base on .sql file ?
or do I have to do it all manually ?
Sequelize-auto can automatically create model file (its a npm package).
You need to have a database created using the SQL file and then use sequelize-auto.
It automatically generate models for SequelizeJS via the command line.
Installation:
npm install -g sequelize-auto
Using command line :
sequelize-auto -o "./models" -d sequelize_auto_test -h localhost -u my_username -p 5432 -x my_password -e postgres
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.