I created a model using sequelize (the code is below) but dont understand how I can update the model. When I changed the model, the old one (with name,num_stars and amenities) still appears in my db and I thought as long i use - sync() - I do update model changes, but apparently not. Can anyone help? Thank you!
my postgreSQL model: db/index.js:
var db = new Sequelize('postgres://localhost:5432/ajax', {
logging: false
});
var Hotel = db.define('hotel', {
name: Sequelize.STRING,
num_stars: {
type: Sequelize.INTEGER,
validate: { min: 1, max: 5 }
},
amenities: Sequelize.STRING
})
module.exports=Hotel;
part of server.js
app.listen(1337, function () {
db.sync()
.then(function(){
console.log('Server listening!');
});
});