Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

dbconsole fails when database_configuration_file is changed

#1710

When you change database_configuration_file in config/environment.rb you can not use script/dbconsole.

In lib/commands/dbconsole.rb the config/database.yml value is hardcoded, so it ignores the application configuration.


env = ARGV.first || ENV['RAILS_ENV'] || 'development'
unless config = YAML::load(ERB.new(IO.read(RAILS_ROOT + "/config/database.yml")).result)[env]
  abort "No database is configured for the environment '#{env}'"
end

I suppose that this was done because it is a lot faster than load Rails environment.

Maybe there is no way to resolve this issue with a clean and fast solution, but I report it FYI :-)

Reported by Ayose · January 7th, 2009 @ 06:50 PM

State: wontfix
Milestone: 2.x
Assigned to: Pratik Pratik
Importance: Low

Activity

  1. Pratik
    Pratik
    • Assigned user set to Pratik
    • State changed from new to wontfix

    For this to work, dbconsole will need to load the rails environment and use Rails.configuration.database_configuration_file as the file name.

    Not sure if this is worth slowing down the console. If someone has the same issue and the patch, I'll apply.

    Thanks !

    March 8th, 2009 @ 04:53 PM

  2. Stephan Wehner
    Stephan Wehner

    The patch for ticket

    allows specifying the database.yml file on the command line.

    May 26th, 2009 @ 05:09 PM

  3. kapouer
    kapouer

    I have the same problem.
    Please see attached simple patch to add a command line argument to dbconsole.rb

    October 28th, 2009 @ 10:51 AM

  4. Jeff Kreeftmeijer
    Jeff Kreeftmeijer
    • Tag cleared.
    • Importance changed from to Low

    Automatic cleanup of spam.

    November 8th, 2010 @ 08:54 AM

  5. Jeff Kreeftmeijer