You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The heroku pg:copy command expects the source and target arguments, as well as the --app flag. Although the --app flag is required, it's only used to resolve attachment names within the command, if needed, and such app doesn't need to be related to the source and target databases.
However, the app name specified in --app isn't necessarily the app related to the target database. This confirmation prompt can cause confusion and lead to data loss, given that one would think that the database that's going to be overwritten is the one mentioned (and typed) in the --confirm prompt, but that might not be the case.
which will cause the confirmApp prompt to ask the user to confirm this operation by typing foo, whereas the affected app is really bar:
In the command above, foo is used to resolve the source DATABASE attachment, but the --app argument shouldn't be understood as the target app by default, which seems to be the current behavior.
Expected behavior
Running:
heroku pg:copy DATABASE bar::DATABASE --app foo
should ask to type bar in the confirmation prompt, given that bar::DATABASE is the database that's going to be overwritten.
This is, target.confirm should be set to the app related to the target attachment, and not directly assigned to the value of the --app flag in the command.
CLI version
$ heroku version
heroku/7.42.1 darwin-x64 node-v12.16.2
In the current revision for pg-v5/commands/copy.js:
Looking for previously reported issues, this is slightly related to #687. However, that issue focuses on the confirmApp prompt not being specific and not showing "fully-qualified" attachment names in the confirmation message.
The text was updated successfully, but these errors were encountered:
Description
The
heroku pg:copy
command expects thesource
andtarget
arguments, as well as the--app
flag. Although the--app
flag is required, it's only used to resolve attachment names within the command, if needed, and such app doesn't need to be related to thesource
andtarget
databases.When the command confirmation is prompted, it uses
target.confirm
, which is earlier set to the value from the--app
flag in the command (except in the case where a URL is used).However, the app name specified in
--app
isn't necessarily the app related to thetarget
database. This confirmation prompt can cause confusion and lead to data loss, given that one would think that the database that's going to be overwritten is the one mentioned (and typed) in the--confirm
prompt, but that might not be the case.Current behavior
Running:
implies that, internally:
which will cause the
confirmApp
prompt to ask the user to confirm this operation by typingfoo
, whereas the affected app is reallybar
:In the command above,
foo
is used to resolve the sourceDATABASE
attachment, but the--app
argument shouldn't be understood as thetarget
app by default, which seems to be the current behavior.Expected behavior
Running:
should ask to type
bar
in the confirmation prompt, given thatbar::DATABASE
is the database that's going to be overwritten.This is,
target.confirm
should be set to the app related to the target attachment, and not directly assigned to the value of the--app
flag in the command.CLI version
In the current revision for
pg-v5/commands/copy.js
:cli/packages/pg-v5/commands/copy.js
Line 47 in aad4882
Looking for previously reported issues, this is slightly related to #687. However, that issue focuses on the
confirmApp
prompt not being specific and not showing "fully-qualified" attachment names in the confirmation message.The text was updated successfully, but these errors were encountered: