waiyaki / postgres-express-node-tutorial

Repository hosting code for the "Getting Started With NodeJS, Express and Postgres Using Sequelize" blogpost.
MIT License
278 stars 103 forks source link

Move cascading delete to hasMany association #3

Closed Pklong closed 7 years ago

Pklong commented 7 years ago

@waiyaki thanks for the great tutorial, it was very helpful. I believe the onDelete option should be passed to the hasMany association if the intention is to remove todoItems associated with a deleted todo. Please let me know if this is all right...

waiyaki commented 7 years ago

Hey @Pklong! Thanks for reaching out!

Correct me if I'm misguided, but I believe the onDelete should be on the child table. See this for conceptual reference. Let me know if this was helpful.

Pklong commented 7 years ago

Yes, you are correct. My apologies!

waiyaki commented 7 years ago

No problem!