PT-153 Fixed regex, updated tests, merged Kenny's fixes

This commit is contained in:
Carlos Salguero
2017-06-28 11:29:50 -03:00
parent 7a128c2bcc
commit ee37f8b88a
2 changed files with 4 additions and 4 deletions

View File

@@ -10053,7 +10053,7 @@ sub get_unique_index_fields {
$clean .= $suffix; $clean .= $suffix;
my $fields = []; my $fields = [];
my $fields_re = qr/UNIQUE\s*(INDEX|KEY|)\s*(?:.*?)* \((.*?)\)/i; my $fields_re = qr/(?:PRIMARY|UNIQUE)\s*(?:INDEX|KEY)\s*(?:.*?)\s*\((.*?)\)/i;
while($clean =~ /$fields_re/g) { while($clean =~ /$fields_re/g) {
push @$fields, [ split /\s*,\s*/, $1 ]; push @$fields, [ split /\s*,\s*/, $1 ];

View File

@@ -58,14 +58,14 @@ isnt(
like( like(
$output, $output,
qr/You are trying to add an unique key. This is highly discouraged./s, qr/You are trying to add an unique key. This can result in data loss if the data is not unique/s,
"PT-153 Adding unique index warning message.", "PT-153 Adding unique index warning message.",
); );
($output, $exit_status) = full_output( ($output, $exit_status) = full_output(
sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=t1", sub { pt_online_schema_change::main(@args, "$master_dsn,D=test,t=t1",
'--execute', '--execute',
'--alter', "ADD UNIQUE INDEX c1 (f2, f3), CREATE UNIQUE INDEX idx2 ON test.t1 (f3)", '--alter', "ADD UNIQUE INDEX c1 (f2, f3), PRIMARY KEY (f3), UNIQUE KEY k2 (f3)",
), ),
}, },
); );
@@ -78,7 +78,7 @@ isnt(
like( like(
$output, $output,
qr/You are trying to add an unique key. This is highly discouraged./s, qr/You are trying to add an unique key. This can result in data loss if the data is not unique/s,
"PT-153 Adding multiple unique indexes warning message.", "PT-153 Adding multiple unique indexes warning message.",
); );