Look at the reverse Sails model
The Sails Inverse Model helps you create JS Sails models, controllers, and views from any database. In addition, you can quickly and individually generate each model, view, controller, or all three at the same time.
Install using the command
npm install sails-inverse-model -g
Know tool
sails-reverse model --help
Example: $ mkdir sails-output $ cd sails-output $ sails-inverse-model -u postgres -p root -d almacen -t pg -m -v -c User : postgres Password : root Database : almacen Host : localhost Models : /home/julian/Documents/sails-output/models Views : /home/julian/Documents/sails-output/views Controllers : /home/julian/Documents/sails-output/controllers DB : pg Schema (pg) : public ===================================== Views [OK] ===================================== Models [OK] ===================================== Controllers [OK] Note: Copy models => your/project_sails/api Copy controllers => your/project_sails/api Copy views
source share