提交 1d83ab93 编写于 作者: E eileencodes

Make sure AR can load without Rails

In #36560 I accidentally re-introduced a bug where ActiveRecord can't be
used without Rails. This returns an empty hash if we're outside the
context of Rails since we can't create the database tasks without
loading and reading the database yaml which is something only Railties
can do.
上级 55eba62a
......@@ -154,6 +154,8 @@ def setup_initial_database_yaml
end
def for_each(databases)
return {} unless defined?(Rails)
database_configs = ActiveRecord::DatabaseConfigurations.new(databases).configs_for(env_name: Rails.env)
# if this is a single database application we don't want tasks for each primary database
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册