mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-26 01:02:25 +08:00
bug-984057 Tests for --preserve-triggers
This commit is contained in:
@@ -819,9 +819,51 @@ like(
|
||||
|
||||
$master_dbh->do("DROP DATABASE test_recursion_method");
|
||||
|
||||
|
||||
# #############################################################################
|
||||
# Tests for --preserve-triggers option
|
||||
# #############################################################################
|
||||
|
||||
test_alter_table(
|
||||
name => "Basic --preserve-triggers",
|
||||
table => "pt_osc.account",
|
||||
pk_col => "id",
|
||||
file => "triggers.sql",
|
||||
test_type => "add_col",
|
||||
new_col => "foo",
|
||||
cmds => [
|
||||
qw(--execute --preserve-triggers), '--alter', 'ADD COLUMN foo INT',
|
||||
],
|
||||
);
|
||||
|
||||
test_alter_table(
|
||||
name => "--preserve-triggers --no-swap-table",
|
||||
table => "pt_osc.account",
|
||||
pk_col => "id",
|
||||
test_type => "add_col",
|
||||
new_col => "foo",
|
||||
cmds => [
|
||||
qw(--execute --preserve-triggers --no-swap-table), '--alter', 'ADD COLUMN foo2 INT',
|
||||
],
|
||||
);
|
||||
|
||||
test_alter_table(
|
||||
name => "FK rebuild_constraints --preserve-triggers",
|
||||
table => "sakila.film",
|
||||
pk_col => "film_id",
|
||||
test_type => "add_col",
|
||||
file => "sakila_triggers.sql",
|
||||
new_col => "foo",
|
||||
check_fks => "rebuild_constraints",
|
||||
cmds => [
|
||||
qw(--execute --preserve-triggers --alter-foreign-keys-method rebuild_constraints), '--alter', 'ADD COLUMN foo INT',
|
||||
],
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
#
|
||||
done_testing;
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
USE sakila;
|
||||
CREATE TRIGGER triggers_migration_test
|
||||
BEFORE
|
||||
-- a comment here
|
||||
INSERT ON film
|
||||
-- just to make things harder
|
||||
FOR EACH ROW SET NEW.length = 60
|
||||
-- for pt_osc
|
||||
;
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user