Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have an active redmine but I can not find the database where it is running right now. It should be on PostgreSQL but the database where it should be running is empty. Does anybody have any idea how to check current database used by redmine?

Please let me know if you need any extra information.

Thank you

EDIT: Ok I know the database it is using. On the database.yml I have project_redmine but it is using the database project I dont know why. That database it is used by developers for the actual project. So that is getting me problems of course. I am unable to run it on the right DB (project_redmine) any ideas? :S

share|improve this question

2 Answers 2

Like any other Rails app, the database information is stored in the config/database.yml file.

share|improve this answer
    
Thanks for your reply. This files is populated but that database is empty. Seems like is not using this file because even if I use a mysql DB there but I don't load in the bundle the pg gem I got an error saying that gem can not be found. It seems it is taking the info from other place rather than database.yml. Is this posible? –  zordor Dec 15 '12 at 1:19
    
Did you accidentally start your app in development instead of production, or vice versa? –  Michael Hampton Dec 15 '12 at 1:20
    
No, that is correct, I am running production –  zordor Dec 16 '12 at 2:20
up vote 0 down vote accepted

I figure out how to do this. You need to get into rails console, that is:

RAILS_ENV=production bundle exec rails console

(Well depending on your environment you might need to change production for test or whatever)

Then run

ActiveRecord::Base.connection

And you will get something like this:

ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x7ff679473020 @connection_parameters=["localhost", port, nil, nil, "database", "user", "pass"]

That worked for me. Now I need to figure out why I have those values... but that is a diferent story...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.