node.js - Unable to access newly added column in sequelize -


i have added migration add new column this:

module.exports = {   up: function(migration, datatypes, done) {     migration.addcolumn('topics','isfeatured',{       type: datatypes.boolean, defaultvalue: false     })     done()   },   down: function(migration, datatypes, done) {     migration.removecolumn('topics', 'isfeatured')     done()   } } 

then run migration

sequelize -m 

its add new column default value. when retrieve api

updatetopic = function (req, res) {   db.topic.find(req.params.id).success(function (topic) {     console.log(topic.isfeatured)     // code   }); }; 

then got console.log(topic.isfeatured) undefined

but console.log(topic) show topic default false value of isfeatured.

so can me find out why console.log(topic.isfeatured) undefined.

thanks

it seems have not added isfeatured column in model definitions, have add model definitions.

module.exports = function (db, datatypes) {   var topic = sequelize.define('topic', {     name: datatypes.string,     // other columns     isfeatured: datatypes.boolean   });   return topic; } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -