w10d5 study day things to remember Flashcards

1
Q

what’s the difference between the create and build methods when creating a new record with sequelize?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you update a record with sequelize?

A

You’d reassign it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you update a record with sequelize?

A

You’d reassign it. Be sure to save it!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you update a record with sequelize?

A

You’d reassign it. Be sure to save it!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does a cascading delete do (onDelete: ‘CASCADE’)?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly