I have a process model that runs 31 queries against our database to remove a person’s information. This works great for 29 out of 31 tables. The last 2 tables are related 1 contains the persons basic information the other contains 1 or more associations for that person. The last table has a foreign key. My process model runs without any errors but when I check the tables the last 2 tables still contain the data.
What is the best way to remove the data without removing the foreign key constraint since this is required for data integrity?
Here is the output from running the show create table command agains the child table:
CREATE TABLE `mtrperson_primarybrands` ( `mtrprsn_primrybrnds_persnid` int(11) NOT NULL, `primarybrands` varchar(255) DEFAULT NULL, `mtrperson_primarybrands_idx` int(11) NOT NULL, PRIMARY KEY (`mtrprsn_primrybrnds_persnid`,`mtrperson_primarybrands_idx`), KEY `FK9E2AC30FB7856593` (`mtrprsn_primrybrnds_persnid`), CONSTRAINT `FK9E2AC30FB7856593` FOREIGN KEY (`mtrprsn_primrybrnds_persnid`) REFERENCES `mtrperson` (`personid`)) ENGINE=InnoDB DEFAULT CHARSET=utf8
Discussion posts and replies are publicly visible
Hello Helmuta,
I was trying to find some solution and came across CASCASE keyword usage along with foreign key. One of the search results says that ..."A foreign key with cascade delete means that if a record in the parent table is deleted, then the corresponding records in the child table will automatically be deleted.".
You can try implementing same
Thank You.