Database: on update and on delete - how to handle?
I'm using InnoDB.
When delete and update actions occur on a particular table, I need to开发者_如何转开发 make certain changes to other tables. Right now, I am dealing with that through code. I'm wondering if there is a benefit to me doing this in the DB level.
Any thoughts? Pros and cons to consider? Gotchas to look out for?
I think you may want to learn about using using MySQL Triggers. Some extra links:
Restrictions overview
MySQL Triggers FAQ
The benefit of doing that at the database level is that those requirements will be enforced for every user and every application. (Including you, when you're sleep-deprived and under pressure.)
精彩评论