开发者

Mysql BEFORE UPDATE trigger activation time

I have two InnoDB tables:

CREATE TABLE master(
   id INTEGER UNSIGNED NOT NULL auto_increment PRIMARY KEY
);

CREATE TABLE details(
   id INTEGER UNSIGNED NOT NULL auto_increment PRIMARY KEY, 
   master_id INTEGER UNSIGNED NOT NULL, CONSTRAINT `byMasterId` 
   FOREIGN KEY (`master开发者_JAVA技巧_id`) REFERENCES `master`(`id`) ON UPDATE CASCADE ON DELETE CASCADE 
);

And I need a BEFORE UPDATE trigger on master table to do some validation (and cancel an update in some cases). Do cascade changes in details table occur after BEFORE UPDATE trigger?


Yes, the "before update" trigger runs before the update on the master table, and the cascade happens after the update on the master table.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜