Monday 31 December 2018

should i be updating model files following a db migration - sequelize cli

hello all, I am getting started with sequelize and sequelize-cli​after creating a model using the sequelize-cli sequelize model:generate function, should I then be going back into the model file and updating the model columns to match exactly what I just put in the migration?​For example if I have some validations in my db table, should i add these validations (ex. allowNull: false) in the model? Should I add foreign keys as well? My gut tells me yes, but I wanted to hear some insight from others who may be more experienced than I.​I will add that without making any changes to these models, my db will return all columns, which leads me to wonder what the point of having these models are in the first place?

Submitted December 31, 2018 at 09:47PM by Dasnowman1183

No comments:

Post a Comment