Defect #15890
closed
rake db:migrate RAILS_ENV=production doesn't update the type feild in the repository table
Added by Robin Polak almost 11 years ago.
Updated almost 11 years ago.
Description
Environment:
Redmine version 2.4.2.stable
Ruby version 1.8.7-p352 (2011-06-30) [i686-linux]
Rails version 3.2.16
Environment production
Database adapter PostgreSQL - 9.1.11
SCM:
Git 1.7.9.5
Filesystem
Redmine plugins:
notify_custom_users 0.0.6
redmine_default_assign 0.4
redmine_embedded 0.0.2
Upgrading Redmine from 1.4.4 to 2.4.2
1.4.4 type = Git
2.4.2 type = Repository::Git
Error from <redmine_home>/log/production.log:
Started GET "/projects/local-lab" for 172.16.20.202 at Thu Jan 16 22:34:09 +0400 2014
Processing by ProjectsController#show as HTML
Parameters: {"id"=>"local-lab"}
Current user: rpolak (id=47)
Rendered projects/_members_box.html.erb (2.5ms)
Rendered projects/show.html.erb within layouts/base (19.3ms)
Completed 500 Internal Server Error in 441.3ms
ActionView::Template::Error (The single-table inheritance mechanism failed to locate the subclass: 'Git'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Repository.inheritance_column to use another column for that information.):
42: <% end >
43:
44: <h1><= page_header_title ></h1>
45:
46: < if display_main_menu?(Herve Harster) >
47: <div id="main-menu">
48: <= render_main_menu(Herve Harster) %>
lib/redmine.rb:255
lib/redmine/menu_manager.rb:199:in `call'
lib/redmine/menu_manager.rb:199:in `allowed_node?'
lib/redmine/menu_manager.rb:166:in `menu_items_for'
lib/redmine/menu_manager.rb:165:in `each'
lib/redmine/menu_manager.rb:165:in `menu_items_for'
lib/redmine/menu_manager.rb:90:in `render_menu'
lib/redmine/menu_manager.rb:80:in `render_main_menu'
app/views/layouts/base.html.erb:45:in `_app_views_layouts_base_html_erb__318726304__634725268'
app/controllers/projects_controller.rb:163:in `show'
Fix:
Apply to PostgreSQL DB:
update repositories set "type" = 'Repository::Git' where "type" = 'Git';
- Status changed from New to Closed
- Resolution set to Invalid
I did run the db migrate. If you would like to can provide more detail.
$ echo "select type from repositories;" | sqlite3 db/pro.sqlite3
Repository::Mercurial
Repository::Mercurial
Repository::Mercurial
Repository::Mercurial
Repository::Git
Repository::Bazaar
Repository::Subversion
$ RAILS_ENV=production rake db:migrate:down VERSION=20120422150750
== ChangeRepositoriesToFullSti: reverting ====================================
== ChangeRepositoriesToFullSti: reverted (0.9885s) ===========================
$ echo "select type from repositories;" | sqlite3 db/pro.sqlite3
Mercurial
Mercurial
Mercurial
Mercurial
Git
Bazaar
Subversion
$ RAILS_ENV=production rake db:migrate:up VERSION=20120422150750
== ChangeRepositoriesToFullSti: migrating ====================================
== ChangeRepositoriesToFullSti: migrated (0.7364s) ===========================
$ echo "select type from repositories;" | sqlite3 db/pro.sqlite3
Repository::Mercurial
Repository::Mercurial
Repository::Mercurial
Repository::Mercurial
Repository::Git
Repository::Bazaar
Repository::Subversion
Hi,
Any update on this,we are facing the same issue while testing locally, before we move it to production.
Environment:
Redmine version 2.4.2.stable
Ruby version 2.1.0-p0 (2013-12-25) [i686-linux]
Rails version 3.2.16
Environment development
Database adapter PostgreSQL - 9.2
Redmine plugins:
periodictask redmine_backlogs redmine_issue_checklist redmine_s3
Upgrading Redmine from 2.3.2devel to 2.4.2
Error from <redmine_home>/log/development.log:
Completed 500 Internal Server Error in 231.6ms
ActionView::Template::Error (The single-table inheritance mechanism failed to locate the subclass: 'Repository::Git'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Repository.inheritance_column to use another column for that information.):
42: <% end %>
43:
44: <h1><%= page_header_title %></h1>
45:
46: <% if display_main_menu?(@project) %>
47: <div id="main-menu">
48: <%= render_main_menu(@project) %>
lib/redmine.rb:255:in `block (2 levels) in <top (required)>'
lib/redmine/menu_manager.rb:199:in `call'
lib/redmine/menu_manager.rb:199:in `allowed_node?'
lib/redmine/menu_manager.rb:166:in `block in menu_items_for'
lib/redmine/menu_manager.rb:165:in `each'
lib/redmine/menu_manager.rb:165:in `menu_items_for'
lib/redmine/menu_manager.rb:90:in `render_menu'
lib/redmine/menu_manager.rb:80:in `render_main_menu'
app/views/layouts/base.html.erb:45:in `_app_views_layouts_base_html_erb__769185914_114836320'
app/controllers/projects_controller.rb:163:in `show'
P.S Still getting this error after running rake db:migrate and restarted the unicorn and nginx..
Defect #15756 solves this issue for me.
Also available in: Atom
PDF