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.
How to get the metadata of a mysql table on sailsjs
-
16-07-2023 - |
質問
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
解決
他のヒント
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
});
所属していません StackOverflow