sql - Never use Cascade Delete becasue we want to keep all logic inside application code -


i'm working on project , sql server database use on delete no action regardless, order-orderitem scenarios.

i recall school professors ask set cascade delete.

senior developers it's because want keep logic inside application code, meaning if want delete order, our code has first delete orderitem.

is valid argument? when should on delete no action used?

yes, it's not preference handling data integrity @ application or business layer known technique. needs tested ensure application doesn't create orphans. i've worked systems developers used business layer handle foreign key constraints , cascade deletes. it's difficult understand relationships , behavior if you're working in backend. needs documented.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -