Remove deprecated `connection` option in the `rails dbconsole` command

This commit is contained in:
Rafael Mendonça França 2020-10-29 18:22:16 +00:00
parent 227d04f46a
commit 8513769ad6
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
4 changed files with 7 additions and 23 deletions

View File

@ -33,7 +33,9 @@ Please refer to the [Changelog][railties] for detailed changes.
### Removals
* Remove depreated `rake notes` tasks.
* Remove deprecated `rake notes` tasks.
* Remove deprecated `connection` option in the `rails dbconsole` command.
### Deprecations

View File

@ -1,3 +1,7 @@
* Remove deprecated `connection` option in the `rails dbconsole` command.
*Rafael Mendonça França*
* Remove depreated `rake notes` tasks.
*Rafael Mendonça França*

View File

@ -168,9 +168,6 @@ module Rails
class_option :header, type: :boolean
class_option :connection, aliases: "-c", type: :string,
desc: "Specifies the connection to use."
class_option :database, aliases: "--db", type: :string,
desc: "Specifies the database to use."
@ -180,13 +177,6 @@ module Rails
# RAILS_ENV needs to be set before config/application is required.
ENV["RAILS_ENV"] = options[:environment]
if options["connection"]
ActiveSupport::Deprecation.warn(<<-MSG.squish)
`connection` option is deprecated and will be removed in Rails 6.1. Please use `database` option instead.
MSG
options["database"] = options["connection"]
end
require_application_and_environment!
Rails::DBConsole.start(options)
end

View File

@ -246,18 +246,6 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase
end
end
def test_connection_options_is_deprecate
command = Rails::Command::DbconsoleCommand.new([], ["-c", "custom"])
Rails::DBConsole.stub(:start, nil) do
assert_deprecated("`connection` option is deprecated") do
command.perform
end
end
assert_equal "custom", command.options["connection"]
assert_equal "custom", command.options["database"]
end
def test_print_help_short
stdout = capture(:stdout) do
Rails::Command.invoke(:dbconsole, ["-h"])