node.js - How to use migrations in Sequelize? -


i have used orms such entityframework, waterline , mongoose. started using sequelize. have created sample model. later wanted add column table corresponding same model. when edit model, new field doesn't seem reflecting in table unless drop table. supposed use migrations? got confused after reading documentation. me out?

yes, should use migrations if edit model in sequelize when application starts create table if doesn't exist. not check if schema different doesn't update schema of table.

if you, install sequelize-cli , run sequelize init command. sets project ready use migrations.

please note using sequelize migrations have explicitly define primary key, updatedat , createdat columns otherwise not great created!

the docs not bad migrations: http://sequelize.readthedocs.org/en/latest/docs/migrations/


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -