This project is archived and is in readonly mode.
dbconsole fails when database_configuration_file is changed
Reported by Ayose | January 7th, 2009 @ 06:50 PM | in 2.x
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 :-)
Comments and changes to this ticket
-
Pratik March 8th, 2009 @ 04:53 PM
- 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 !
-
Stephan Wehner May 26th, 2009 @ 05:09 PM
The patch for ticket
allows specifying the database.yml file on the command line.
-
kapouer October 28th, 2009 @ 10:51 AM
I have the same problem.
Please see attached simple patch to add a command line argument to dbconsole.rb -
Jeff Kreeftmeijer November 8th, 2010 @ 08:54 AM
- Tag cleared.
- Importance changed from to Low
Automatic cleanup of spam.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 4141 The rake tasks db:create and db:drop throws an error when the database.yml file is configured in a non default location. Also, there is at least one more issue concerning the dat...