bug-984057 Tests for --preserve-triggers

This commit is contained in:
Carlos Salguero
2016-07-05 16:27:25 -03:00
parent c9ed7aeb94
commit f8c91c2c3b
5 changed files with 128 additions and 3 deletions
+42
View File
@@ -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