PT-91 WIP

This commit is contained in:
Carlos Salguero
2017-07-05 11:19:04 -03:00
parent 2ccf81ef8a
commit 7772630bf5
3 changed files with 37 additions and 25 deletions

View File

@@ -8300,27 +8300,10 @@ sub main {
die $msg;
}
if ( !$o->get('drop-old-table') && $o->get('preserve-triggers') ) {
my $msg = "Cannot use --no-drop-old-table and --preserve-triggers together.\n"
. "--preserve-triggers implies that the old table and triggers "
. " should be deleted and recreated into the new table.\n"
. "Please read the documentation for --preserve-triggers";
die $msg;
}
if ( !$o->get('swap-tables') && $o->get('preserve-triggers') ) {
my $msg = "Canot use --no-swap-tables with --preserve-triggers since trigger names "
. "cannot be duplicated so, the old table and triggers should be deleted "
. "and recreated into the new table.\n"
. "Please read the documentation for --preserve-triggers";
die $msg;
}
if ( $o->get('preserve-triggers') ) {
$o->set('drop-triggers', 1);
}
if ( !$o->get('help') ) {
if ( @ARGV ) {
$o->save_error('Specify only one DSN on the command line');

View File

@@ -847,7 +847,7 @@ SKIP: {
skip 'Sandbox MySQL version should be >= 5.7' unless $sandbox_version ge '5.7';
test_alter_table(
name => "Basic --preserve-triggers #1",
name => 'Basic --preserve-triggers #1',
table => "pt_osc.account",
pk_col => "id",
file => "triggers.sql",
@@ -896,26 +896,28 @@ SKIP: {
($output, $exit) = full_output(
sub { pt_online_schema_change::main(@args,
"$dsn,D=pt_osc,t=t",
"$dsn,D=test,t=t1",
qw(--execute --no-swap-tables --preserve-triggers), '--alter', 'ADD COLUMN foo INT')
},
stderr => 1,
);
diag($output);
isnt(
$exit,
0,
"--preserve-triggers --no-swap-tables",
is(
$exit,
0,
"--preserve-triggers --no-swap-tables",
);
($output, $exit) = full_output(
sub { pt_online_schema_change::main(@args,
"$dsn,D=pt_osc,t=t",
"$dsn,D=test,t=t1",
qw(--execute --no-drop-old-table --preserve-triggers), '--alter', 'ADD COLUMN foo INT')
},
stderr => 1,
);
diag($output);
isnt(
$exit,
0,

File diff suppressed because one or more lines are too long