ExpressJS + Sequelize er_bad_field_error: Unknown column in fieldlist ExpressJS + Sequelize er_bad_field_error: Unknown column in fieldlist express express

ExpressJS + Sequelize er_bad_field_error: Unknown column in fieldlist


Maybe sequelize/SQL is confused because of an existing row in an old table. Have you tried deleting any existing tables in the db if you've already made some? As it was said already, syncing the db is important, but also set "force" to true so that you wipe the old tables (ONLY DO THIS IF YOUR DB ISN'T IN PRODUCTION!). It's in the docs: http://docs.sequelizejs.com/en/1.7.0/articles/getting-started/

It worked for me.

sequelize .sync({ force: true }).then(function(err) {    console.log('It worked!');  }, function (err) {          console.log('An error occurred while creating the table:', err);  });


Adding sync({ force: true }) will recreate the table while deleting all entries that is if you have the db in production. You can try using the same but with an alter option sync({ alter: true }). It will try and update the new or remove the old values without much harm. I would try it first in dev mode before pushing to production.