문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top