I begin with SailsJS
and MySQL
, and I have many tables in my database. So, I don't know that in SailsJS
has a tool to generate models from database like Database First
in Entity Framework
(ASP
)
You should use, it's very good to auto generate model base DB existing.
https://www.npmjs.com/package/sails-generate-models
SailsJS does not have such a tool implemented.
Though, it should not be hard to create that yourself since MySQL's SHOW COLUMNS FROM table
works quite well. Then you'd just have to create the .js model files.
Be wary of the configuration in config/models.js
and set migrate to safe as you might drop some columns if you haven't tested and are not sure if you've generated the models correctly.
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