mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-22 20:19:00 +00:00
Add forked Maatkit tools in bin/ and their tests in t/.
This commit is contained in:
31
t/pt-online-schema-change/samples/fk_tables_schema.sql
Normal file
31
t/pt-online-schema-change/samples/fk_tables_schema.sql
Normal file
@@ -0,0 +1,31 @@
|
||||
DROP DATABASE IF EXISTS `mkosc`;
|
||||
CREATE DATABASE `mkosc`;
|
||||
USE `mkosc`;
|
||||
|
||||
CREATE TABLE `country` (
|
||||
`country_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`country` varchar(50) NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`country_id`)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `city` (
|
||||
`city_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`city` varchar(50) NOT NULL,
|
||||
`country_id` smallint(5) unsigned NOT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`city_id`),
|
||||
KEY `idx_fk_country_id` (`country_id`),
|
||||
CONSTRAINT `fk_city_country` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE `address` (
|
||||
`address_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`address` varchar(50) NOT NULL,
|
||||
`city_id` smallint(5) unsigned NOT NULL,
|
||||
`postal_code` varchar(10) DEFAULT NULL,
|
||||
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (`address_id`),
|
||||
KEY `idx_fk_city_id` (`city_id`),
|
||||
CONSTRAINT `fk_address_city` FOREIGN KEY (`city_id`) REFERENCES `city` (`city_id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB;
|
Reference in New Issue
Block a user