1CREATE TABLE parent (
2id INT NOT NULL,
3PRIMARY KEY (id)
4) ENGINE=InnoDB;
5CREATE TABLE child (
6id INT,
7parent_id INT,
8FOREIGN KEY (parent_id)
9REFERENCES parent(id)
10ON UPDATE SET NULL
11ON DELETE SET NULL
12) ENGINE=InnoDB;
13INSERT INTO parent VALUES (1),(2);
14INSERT INTO child VALUES (1,1),(2,2);
15connection node_2;
16DELETE FROM parent WHERE id = 1;
17SELECT parent_id IS NULL FROM child WHERE id = 1;
18parent_id IS NULL
191
20connection node_1;
21SELECT parent_id IS NULL FROM child WHERE id = 1;
22parent_id IS NULL
231
24UPDATE parent SET id = 3 WHERE id = 2;
25SELECT parent_id IS NULL FROM child WHERE id = 2;
26parent_id IS NULL
271
28connection node_2;
29SELECT parent_id IS NULL FROM child WHERE id = 2;
30parent_id IS NULL
311
32connection node_1;
33DROP TABLE child;
34DROP TABLE parent;
35