Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
137 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
connection node_2; | ||
connection node_1; | ||
CREATE TABLE author ( | ||
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
name VARCHAR(100) NOT NULL | ||
) ENGINE = InnoDB; | ||
CREATE TABLE book ( | ||
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
title VARCHAR(200) NOT NULL, | ||
author_id SMALLINT UNSIGNED NOT NULL, | ||
CONSTRAINT `fk_book_author` | ||
FOREIGN KEY (author_id) REFERENCES author (id) | ||
ON DELETE CASCADE | ||
ON UPDATE RESTRICT | ||
) ENGINE = InnoDB; | ||
INSERT INTO author (name) VALUES ('Abdul Alhazred'); | ||
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID()); | ||
TRUNCATE TABLE book; | ||
SELECT * FROM author; | ||
id name | ||
1 Abdul Alhazred | ||
SELECT * FROM book; | ||
id title author_id | ||
connection node_2; | ||
SELECT * FROM author; | ||
id name | ||
1 Abdul Alhazred | ||
SELECT * FROM book; | ||
id title author_id | ||
INSERT INTO author (name) VALUES ('Abdul Alhazred'); | ||
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID()); | ||
TRUNCATE TABLE book; | ||
SELECT * FROM author; | ||
id name | ||
1 Abdul Alhazred | ||
2 Abdul Alhazred | ||
SELECT * FROM book; | ||
id title author_id | ||
connection node_1; | ||
TRUNCATE TABLE book; | ||
SELECT * FROM author; | ||
id name | ||
1 Abdul Alhazred | ||
2 Abdul Alhazred | ||
SELECT * FROM book; | ||
id title author_id | ||
DROP TABLE book, author; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--source include/galera_cluster.inc | ||
|
||
CREATE TABLE author ( | ||
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
name VARCHAR(100) NOT NULL | ||
) ENGINE = InnoDB; | ||
|
||
CREATE TABLE book ( | ||
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | ||
title VARCHAR(200) NOT NULL, | ||
author_id SMALLINT UNSIGNED NOT NULL, | ||
CONSTRAINT `fk_book_author` | ||
FOREIGN KEY (author_id) REFERENCES author (id) | ||
ON DELETE CASCADE | ||
ON UPDATE RESTRICT | ||
) ENGINE = InnoDB; | ||
|
||
INSERT INTO author (name) VALUES ('Abdul Alhazred'); | ||
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID()); | ||
|
||
TRUNCATE TABLE book; | ||
SELECT * FROM author; | ||
SELECT * FROM book; | ||
|
||
--connection node_2 | ||
SELECT * FROM author; | ||
SELECT * FROM book; | ||
INSERT INTO author (name) VALUES ('Abdul Alhazred'); | ||
INSERT INTO book (title, author_id) VALUES ('Necronomicon', LAST_INSERT_ID()); | ||
TRUNCATE TABLE book; | ||
SELECT * FROM author; | ||
SELECT * FROM book; | ||
|
||
--connection node_1 | ||
TRUNCATE TABLE book; | ||
SELECT * FROM author; | ||
SELECT * FROM book; | ||
|
||
DROP TABLE book, author; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters