Sails Model.destroy() fails

A few days ago i ran into an issue where i was getting the following error running destroy() on a MySql database table.

Investigating further, i came to know that the table in question by chance did not have a primary key.

Looking into the destroy function in the sails-mysql adapter, I figured out the reason to be the callback which is setup to order by the primary key column by default. When it does not have a primary key column, it has undefined and the callback fails.

So i added a primary key and that resolved the issue. I hope it helps someone 🙂

alexey

alexey

Application developer, movie buff, occasional reader and a huge Manchester United fan.
alexey

Application developer, movie buff, occasional reader and a huge Manchester United fan.