質問

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

役に立ちましたか?

解決

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.

他のヒント

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
      });
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top