mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Revert "Merge pull request #32075 from eileencodes/delete-default-configuration"
This reverts commit16f279ebd4
, reversing changes made to6c6a30a7c3
. The config can be named anything, not just default (although all generated apps will be named default). We can't just delete configs that don't have a database because that will break three-tier configs. Oh well.
This commit is contained in:
parent
edb61ca8dc
commit
ae01c921fb
3 changed files with 20 additions and 1 deletions
|
@ -315,12 +315,16 @@ module ActiveRecord
|
|||
environments << "test" if environment == "development"
|
||||
|
||||
ActiveRecord::Base.configurations.slice(*environments).each do |configuration_environment, configuration|
|
||||
next unless configuration["database"]
|
||||
|
||||
yield configuration, configuration_environment
|
||||
end
|
||||
end
|
||||
|
||||
def each_local_configuration
|
||||
ActiveRecord::Base.configurations.each_value do |configuration|
|
||||
next unless configuration["database"]
|
||||
|
||||
if local_database?(configuration)
|
||||
yield configuration
|
||||
else
|
||||
|
|
|
@ -124,6 +124,14 @@ module ActiveRecord
|
|||
ActiveRecord::Base.connection_handler.stubs(:establish_connection)
|
||||
end
|
||||
|
||||
def test_ignores_configurations_without_databases
|
||||
@configurations["development"].merge!("database" => nil)
|
||||
|
||||
ActiveRecord::Tasks::DatabaseTasks.expects(:create).never
|
||||
|
||||
ActiveRecord::Tasks::DatabaseTasks.create_all
|
||||
end
|
||||
|
||||
def test_ignores_remote_databases
|
||||
@configurations["development"].merge!("host" => "my.server.tld")
|
||||
$stderr.stubs(:puts).returns(nil)
|
||||
|
@ -242,6 +250,14 @@ module ActiveRecord
|
|||
ActiveRecord::Base.stubs(:configurations).returns(@configurations)
|
||||
end
|
||||
|
||||
def test_ignores_configurations_without_databases
|
||||
@configurations[:development].merge!("database" => nil)
|
||||
|
||||
ActiveRecord::Tasks::DatabaseTasks.expects(:drop).never
|
||||
|
||||
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
||||
end
|
||||
|
||||
def test_ignores_remote_databases
|
||||
@configurations[:development].merge!("host" => "my.server.tld")
|
||||
$stderr.stubs(:puts).returns(nil)
|
||||
|
|
|
@ -179,7 +179,6 @@ module Rails
|
|||
values.reverse_merge!(shared)
|
||||
end
|
||||
end
|
||||
loaded_yaml.delete("default")
|
||||
Hash.new(shared).merge(loaded_yaml)
|
||||
elsif ENV["DATABASE_URL"]
|
||||
# Value from ENV['DATABASE_URL'] is set to default database connection
|
||||
|
|
Loading…
Reference in a new issue