I'm trying to use ON CASCADE DELETE in mysql db but I can't make it work. Here is my code:
CREATE TABLE sometable
(
testId CHAR(43),
blocked BOOL,
PRIMARY KEY(testId)
);
CREATE TABLE p
(
testId CHAR(43),
phrase text,
source text,
FOREIGN KEY (testId) REFERENCES sometable (testId) on delete cascade
);
CREATE TRIGGER sometable_insert BEFORE INSERT ON `sometable` FOR EACH ROW SET NEW.`testId` =UUID();
I then perform an insert into sometable, which will generate a UUID. I take this UUID and insert it to table p. insert into p(testId, phrase, source) values('07616f60-424f-11df-871a-b98e9', 'fun', 'test');
When doing a delete on the row in sometable nothing happens in table p. What have i missed or what I'm i doing wrong