Remove deprecated `connection` option in the `rails dbconsole` command
This commit is contained in:
parent
227d04f46a
commit
8513769ad6
|
@ -33,7 +33,9 @@ Please refer to the [Changelog][railties] for detailed changes.
|
||||||
|
|
||||||
### Removals
|
### Removals
|
||||||
|
|
||||||
* Remove depreated `rake notes` tasks.
|
* Remove deprecated `rake notes` tasks.
|
||||||
|
|
||||||
|
* Remove deprecated `connection` option in the `rails dbconsole` command.
|
||||||
|
|
||||||
### Deprecations
|
### Deprecations
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
* Remove deprecated `connection` option in the `rails dbconsole` command.
|
||||||
|
|
||||||
|
*Rafael Mendonça França*
|
||||||
|
|
||||||
* Remove depreated `rake notes` tasks.
|
* Remove depreated `rake notes` tasks.
|
||||||
|
|
||||||
*Rafael Mendonça França*
|
*Rafael Mendonça França*
|
||||||
|
|
|
@ -168,9 +168,6 @@ module Rails
|
||||||
|
|
||||||
class_option :header, type: :boolean
|
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,
|
class_option :database, aliases: "--db", type: :string,
|
||||||
desc: "Specifies the database to use."
|
desc: "Specifies the database to use."
|
||||||
|
|
||||||
|
@ -180,13 +177,6 @@ module Rails
|
||||||
# RAILS_ENV needs to be set before config/application is required.
|
# RAILS_ENV needs to be set before config/application is required.
|
||||||
ENV["RAILS_ENV"] = options[:environment]
|
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!
|
require_application_and_environment!
|
||||||
Rails::DBConsole.start(options)
|
Rails::DBConsole.start(options)
|
||||||
end
|
end
|
||||||
|
|
|
@ -246,18 +246,6 @@ class Rails::DBConsoleTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
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
|
def test_print_help_short
|
||||||
stdout = capture(:stdout) do
|
stdout = capture(:stdout) do
|
||||||
Rails::Command.invoke(:dbconsole, ["-h"])
|
Rails::Command.invoke(:dbconsole, ["-h"])
|
||||||
|
|
Loading…
Reference in New Issue