mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-08 11:07:58 +00:00
asks for confirmation when using alter-foreign-key-method none - issue 1329422
This commit is contained in:
@@ -7860,6 +7860,16 @@ sub main {
|
||||
$o->save_error("Invalid --alter-foreign-keys-method value: $alter_fk_method");
|
||||
}
|
||||
|
||||
# Issue a strong warning if alter-foreign-keys-method = none
|
||||
if ( $alter_fk_method eq 'none' && !$o->get('force') ) {
|
||||
print STDERR "WARNING! Using alter-foreign-keys-method = \"none\". This will typically cause foreign key violations!\nThis method of handling foreign key constraints is only provided so that the database administrator can disable the tool’s built-in functionality if desired.\n\nContinue anyway? (y/N)";
|
||||
my $response;
|
||||
chomp($response = <STDIN>);
|
||||
if ($response !~ /y|(yes)/i) {
|
||||
exit 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $alter_fk_method eq 'drop_swap' && !$o->get('drop-new-table') ) {
|
||||
$o->save_error("--alter-foreign-keys-method=drop_swap does not work with --no-drop-new-table.");
|
||||
}
|
||||
@@ -11025,6 +11035,10 @@ only perform some safety checks and exit. This helps ensure that you have read
|
||||
documentation and understand how to use this tool. If you have not read the
|
||||
documentation, then do not specify this option.
|
||||
|
||||
=item --force
|
||||
|
||||
This options bypasses confirmation in case of using alter-foreign-keys-method = none , which might break foreign key constraints.
|
||||
|
||||
=item --help
|
||||
|
||||
Show help and exit.
|
||||
|
@@ -591,7 +591,7 @@ test_alter_table(
|
||||
test_type => "new_engine",
|
||||
new_engine => "innodb",
|
||||
cmds => [
|
||||
qw(--execute --alter-foreign-keys-method none --alter ENGINE=INNODB)
|
||||
qw(--execute --alter-foreign-keys-method none --force --alter ENGINE=INNODB)
|
||||
],
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user