PT-1760 Updated DSNParser module

This commit is contained in:
Carlos Salguero
2019-10-01 08:26:42 -03:00
parent 4fc3d9fd1f
commit 522f8c5821
23 changed files with 585 additions and 51 deletions

View File

@@ -28,7 +28,8 @@ if ( !$master_dbh ) {
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
# so we need to specify --set-vars innodb_lock_wait_timeout-3 else the
# tool will die.
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
$master_dbh->do('SET @@collation_server="latin1_swedish_ci"');
my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox,charset=utf8';
my @args = (qw(--set-vars innodb_lock_wait_timeout=3 --alter-foreign-keys-method rebuild_constraints));
my $output;
my $exit_status;
@@ -47,11 +48,10 @@ $sb->load_file('master', "$sample/long_fk_constraints.sql");
sub { pt_online_schema_change::main(@args,
"$master_dsn,D=bug1215587,t=Table1",
"--alter", "ENGINE=InnoDB",
"--charset", "utf8",
qw(--execute)) },
);
warn $output;
my $query = <<_SQL;
SELECT TABLE_NAME, CONSTRAINT_NAME
FROM information_schema.KEY_COLUMN_USAGE
@@ -65,10 +65,10 @@ my $constraints = $master_dbh->selectall_arrayref($query);
is_deeply(
$constraints,
[
[ 'Table1', '__fkey1a' ],
[ 'Table1', '__fkey_SALES_RECURRING_PROFILE_CUSTOMER_CUSTOMER_ENTITY_ENTITY_I' ],
[ 'Table2', '__fkey2b' ],
[ 'Table2', '_fkey2a' ],
[ 'Table1', '_fkey1a' ],
[ 'Table1', '_fkey_SALES_RECURRING_PROFILE_CUSTOMER_CUSTOMER_ENTITY_ENTITY_ID' ],
[ 'Table2', 'fkey2a' ],
[ 'Table2', '_fkey2b' ],
],
"First run adds or removes underscore from constraint names, accordingly"
);