I was wondering if you can get the metadata or the entire structure of the table and columns using sailsjs or waterline's mysql module
Asked
Active
Viewed 348 times
2
2 Answers
4
After hours of searching, I've finally found the holy grail. Well half of the holy grail. Anyway, I just followed the instructions given here: https://github.com/balderdashy/sails/issues/780 then created my own custom query.

mateeyow
- 1,306
- 1
- 17
- 38
0
Yes its very easy to get structure of MySQL table by Waterline SalsJS...
Model.query("desc table_name",function (err, models) {
if(!err)
{
//Do somethng wth your data in models variable
}
}
)
Here table_name is your table name
For me, below code was working fine...
db('users_table').query("SHOW COLUMNS FROM users_table",function (err, models) {
if (! err )
// working with data
});

Ali Uzair
- 11
- 2