Problema changing database URL
Added by Daniel Camargo about 14 years ago
Recently we created a server for PostgreSQL and we started migrating our systems to that server.
When I tried to do that with redmine I followed these steps:
1 - I created a backup file for the old database server (utf-8)
2 - I created a new database in the new database server (utf-8)
3 - I created a new user in the new database server for the redmine database (with the same name and password from the old server)
4 - I restored the backup file from step 1 in the new database server.
5 - I changed the configuration file from:
production: adapter: postgresql database: redmine host: old_server username: redmine password: **** encoding: utf8
To:
production: adapter: postgresql database: redmine host: new_server username: redmine password: **** encoding: utf8
I restarted the server and when I tried to access redmine I got the following error:
ActionView::TemplateError (undefined method `-' for nil:NilClass) on line #6 of app/views/news/_news.rhtml: 3: <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %> 4: <br /> 5: <% unless news.summary.blank? %><span class="summary"><%=h news.summary %></span><br /><% end %> 6: <span class="author"><%= authoring news.created_on, news.author %></span></p> app/helpers/application_helper.rb:286:in `time_tag' app/helpers/application_helper.rb:282:in `authoring' app/views/news/_news.rhtml:6:in `_run_rhtml_app47views47news47_news46rhtml_locals_news_news_counter_object' app/views/welcome/index.rhtml:8:in `_run_rhtml_app47views47welcome47index46rhtml' /usr/lib/ruby/1.8/rack/head.rb:9:in `call' /usr/lib/ruby/1.8/rack/methodoverride.rb:24:in `call' /usr/lib/ruby/1.8/rack/lock.rb:11:in `call' /usr/lib/ruby/1.8/rack/lock.rb:11:in `synchronize' /usr/lib/ruby/1.8/rack/lock.rb:11:in `call' /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request' /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/utils.rb:252:in `safe_fork' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start' /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:222:in `start' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:253:in `spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:247:in `spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:246:in `spawn_rails_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:145:in `spawn_application' /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:278:in `handle_spawn_application' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop' /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously' /usr/lib/phusion_passenger/passenger-spawn-server:61 Rendering /opt/redmine-1.0/public/500.html (500 Internal Server Error)
What I already did¶
1 - I accessed the PostgreSQL's new server from the redmine server to check if it was a connection problem
psql -h new_server -U redmine
Connection OK!
2 - I tried to run the scripts to reconfigure the database
rake db:migrate RAILS_ENV="production" rake redmine:load_default_data RAILS_ENV="production"
What should I do?¶
Replies (3)
RE: Problema changing database URL - Added by Felix Schäfer about 14 years ago
Make sure the ids have been copied ok and that they haven't been shuffled do to some autoincrement.
RE: Problema changing database URL - Added by Daniel Camargo about 14 years ago
The ids were imported correctly. I'm really lost on that one!
RE: Problema changing database URL - Added by Felix Schäfer about 14 years ago
See if all entries in the news
table have a created_on
.