w10d5 study day things to remember Flashcards
what’s the difference between the create and build methods when creating a new record with sequelize?
Create does both build and save methods (2 in 1)
Build just builds a new record. In order to use it you must use the save method as well.
How do you update a record with sequelize?
You’d reassign it.
How do you update a record with sequelize?
You’d reassign it. Be sure to save it!
How do you update a record with sequelize?
You’d reassign it. Be sure to save it!
What does a cascading delete do (onDelete: ‘CASCADE’)?
When you have foreign keys that reference other tables and you want to delete one of the foreign keys, you won’t be able to just delete the one, you must delete all relations.
The cascading allows you to delete foreign keys and the associations.
Ex. If you try to delete a recipe from a database. you must delete all ingredients and instructions associated with that recipe. cascading delete allows you to do that.