开发者

Database: on update and on delete - how to handle?

开发者 https://www.devze.com 2023-02-23 08:57 出处:网络
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 wo

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.)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号