Reputation: 774
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 ?
Upvotes: 0
Views: 1524
Reputation: 1861
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
Upvotes: 1