Project

General

Profile

No repository tab in project and error 500 while accessing settings

Added by jbd jbd over 10 years ago

Hi everybody,

here is the situation. I'm migrating from a redmine 1.2 installation mysql installation to a 2.3.3 postgresql installation.

Quickly, this is what I've done to achieve that (inspired from this) :

  • on the old server, I've used mysqldump with the --hex-blob option and ignored some unused plugins table in the new installation :
$ mysqldump -u redmine -p --compatible=postgresql --skip-add-drop-table --skip-add-locks  --skip-create-options --skip-extended-insert --default-character-set=utf8 -n -t -r /tmp/redmine_mysql_blob.sql redmine --hex-blob --ignore-table=redmine.issue_versions --ignore-table=redmine.todos --ignore-table=redmine.favourite_projects
  • I've escaped all strings directly in the the redmine_mysql_blob.sql file :
$ sed "s/,'/,E'/g" /tmp/redmine_mysql_blob.sql > /tmp/redmine_postgres_blob.sql
  • I've hacked the resulting redmine_mysql_blob.sql to explicitely decode hex blob (see this)
$ sed "s/,0x\([0-9,A-F]*\),/,decode('\1','hex'),/g" /tmp/redmine_postgres_blob.sql > /tmp/redmine_postgres_blob_decode.sql
  • on the new server, I've created the postgresql database and run the usual stuff :

In postgresql :

template1=# CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;

In the redmine installation directory :

$ RAILS_ENV=production rake db:migrate
$ RAILS_ENV=production rake redmine:plugins:migrate 
$ psql redmine -f truncate.sql 
$ psql redmine -f boolean.sql 
  • I've imported my hacked dump from the old redmine installation :
$ psql -q redmine -f /tmp/redmine_postgres_blob_decode.sql 2> error_import.txt
$ wc -l error_import.txt
0
  • I've run the final two psql scripts always from the same page :
$ psql redmine -f varying.sql 
DO
$ psql redmine -f sequences.sql 
DO
  • I've configured Apache, webdav subversion stuff, launched reposman.rb, and everything looks fine : unicode character, issues, wiki etc but I don't have any repository tab in my project and when I try to access the project settings, I've got an internal error 500 which correspond to this in the redmine log :
Started GET "/projects/mobyle/settings" for 1.2.3.4 at 2013-12-04 09:16:36 +0100
Processing by ProjectsController#settings as HTML
  Parameters: {"id"=>"mobyle"}
  Current user: jbd (id=94)
  Rendered projects/_form.html.erb (47.8ms)
  Rendered projects/_edit.html.erb (49.7ms)
  Rendered projects/settings/_modules.html.erb (5.1ms)
  Rendered projects/settings/_members.html.erb (265.6ms)
  Rendered projects/settings/_versions.html.erb (42.2ms)
  Rendered projects/settings/_issue_categories.html.erb (2.2ms)
  Rendered projects/settings/_wiki.html.erb (2.6ms)
  Rendered projects/settings/_repositories.html.erb (8.6ms)
  Rendered common/_tabs.html.erb (384.0ms)
  Rendered projects/settings.html.erb within layouts/base (385.2ms)
Completed 500 Internal Server Error in 402ms

ActionView::Template::Error (The single-table inheritance mechanism failed to locate the subclass: 'Subversion'. 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.):
    10:     </tr>
    11:   </thead>
    12:   <tbody>
    13:   <% @project.repositories.sort.each do |repository| %>
    14:     <tr class="<%= cycle 'odd', 'even' %>">
    15:       <td>
    16:       <%= link_to repository.identifier, 
  app/views/projects/settings/_repositories.html.erb:13:in `_app_views_projects_settings__repositories_html_erb___3594549268754752900_17269517860'
  app/views/common/_tabs.html.erb:24:in `block in _app_views_common__tabs_html_erb__2138850186984914202_17308254360'
  app/views/common/_tabs.html.erb:23:in `each'
  app/views/common/_tabs.html.erb:23:in `_app_views_common__tabs_html_erb__2138850186984914202_17308254360'
  app/helpers/application_helper.rb:271:in `render_tabs'
  app/views/projects/settings.html.erb:3:in `_app_views_projects_settings_html_erb__4103225549096871892_17308251900'

Any ideas ? Redmine is quite new to me and I don't have enough knowledge of its internal to deal with that kind of error easily. I must have miss something during the dirty conversion from mysql to postgresql.


Installation details :


$ RAILS_ENV=production script/about

Environment:
  Redmine version                2.3.3.stable
  Ruby version                   2.0.0-p247 (2013-06-27) [x86_64-freebsd9.1]
  Rails version                  3.2.13
  Environment                    production
  Database adapter               PostgreSQL
Redmine plugins:
  redmine_wiki_extensions        0.6.4


Replies (5)

RE: No repository tab in project and error 500 while accessing settings - Added by jbd jbd over 10 years ago

Looks like that : http://stackoverflow.com/questions/11470011/activerecordsubclassnotfound

The single-table inheritance error is probably caused by a column named type in your database.

If rails encounters a column name called type it assumes it's a Model that has Subclasses so the type discriminates what model to use. I guess some plugin that was not originally built for rails uses a type column in it's model and that causes Rails to fail.

Should I observe that or is this a sign of something that I did wrong during my multiple migration hacks ?

If not, what is the cleanest and future proof way to deal with this ?

RE: No repository tab in project and error 500 while accessing settings - Added by jbd jbd over 10 years ago

I'll try to run db:migrate again to fix the type table entries. The 20120422150750_change_repositories_to_full_sti.rb script should do the trick.

RE: No repository tab in project and error 500 while accessing settings - Added by jbd jbd over 10 years ago

Looks like I can't run db:migrate again after my sql import. I don't think it is normal. Anyone could explain to me this behaviour ?

$ RAILS_ENV=production rake db:migrate
==  CreateChangesetParents: migrating =========================================
-- create_table(:changeset_parents, {:id=>false})
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::DuplicateTable: ERROR:  relation "changeset_parents" already exists

RE: No repository tab in project and error 500 while accessing settings - Added by jbd jbd over 10 years ago

Ok, since I've already run db:migrate before importing my old database, it already has a bunch of stuff present in db/migrate/*rb script.

What would be the right way to deal with that ? Comment everything's coming up from db:migration in the corresponding db/migrate/* file, and iterate until it's good ? If I do this, will it be ok in the future redmine upgrade ? Is there a better way ?

RE: No repository tab in project and error 500 while accessing settings - Added by jbd jbd over 10 years ago

I've commented out the db/migrate/ scripts lignes leading to each problem (index, column or table creation) and now everything is fine : I've go my repository tab and I can access projects settings.

Comments ? Maybe there is a more idiomatic way to do that ?

    (1-5/5)