Skip to content

Instantly share code, notes, and snippets.

@sokil
Created June 27, 2016 21:32
Show Gist options
  • Save sokil/26a0b5c70d8f9276fe4930dd3b932b94 to your computer and use it in GitHub Desktop.
Save sokil/26a0b5c70d8f9276fe4930dd3b932b94 to your computer and use it in GitHub Desktop.
pt-online-schema-change
CREATE TRIGGER `pt_osc_test_users_del` AFTER DELETE ON `test`.`users` FOR EACH ROW DELETE IGNORE FROM `test`.`_users_new` WHERE `test`.`_users_new`.`id` <=> OLD.`id`
CREATE TRIGGER `pt_osc_test_users_upd` AFTER UPDATE ON `test`.`users` FOR EACH ROW REPLACE INTO `test`.`_users_new` (`id`, `name`, `password`) VALUES (NEW.`id`, NEW.`name`, NEW.`password`)
CREATE TRIGGER `pt_osc_test_users_ins` AFTER INSERT ON `test`.`users` FOR EACH ROW REPLACE INTO `test`.`_users_new` (`id`, `name`, `password`) VALUES (NEW.`id`, NEW.`name`, NEW.`password`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment