This project is archived and is in readonly mode.

#4141 open
Kandada Boggu

The rake tasks db:create and db:drop throws an error when the database.yml file is configured in a non default location.

Reported by Kandada Boggu | March 10th, 2010 @ 09:11 AM | in 2.3.10

The rake tasks db:create and db:drop throws an error when the database.yml file is configured in a non default location.

The database.yml file location is configured using the database_configuration_file attribute of Rails::Configuration class.

environment.rb

RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
  config.time_zone = 'UTC'

  # configure the database.yml file location
  config.database_configuration_file = File.join("c:/siteconfig/test", 'database.yml')
end

Rake tasks db:drop and db:create throw the following error:

>rake db:drop
(in C:/test)
rake aborted!
No such file or directory - C:/test/config/database.yml
I am able to run the other rake tasks such as db:migrate. The rails application runs without any error.

I located the issue in db:load_config.

task :load_config => :rails_env do
 require 'active_record'
 ActiveRecord::Base.configurations = Rails::Configuration.new.database_configuration
end
This task ignores the database config file location override in environment.rb. Hence the location always defaults to RAILS_ROOT/config/database.yml.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

Attachments

Pages