Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Support Installation & Updates
  1. OpenProject
  2. Forums
  3. Support Installation & Updates
  4. Migration error OP 2.4 to OP 3.0 and wiki history

Migration error OP 2.4 to OP 3.0 and wiki history

Added by mab internet over 9 years ago

Hi all,

I am facing a strange error while migrating from OpenProject 2.4 to 3.0. I would like to see if some of you have some ideas on how to solve it. This is just an intermediate step from the whole migration ChiliProject 3.2.1 to OpenProject 4.2.6.
The CP database was prepared and migrated to OP2.4; but the migration to OP3.0 produces a strange error. When I try to see any of the versions (except the last one) of any wiki page in OP 3.0 I get an error. The log is this:

ActionView::Template::Error (undefined method `attachments’ for nil:NilClass):
28: #%>
29:
30:

31: <%= textilizable content, :text, :attachments => content.page.attachments %>
32:

app/views/wiki/_content.html.erb:31:in `_app_views_wikicontent_html_erb_1793192035334457579_70023254911700’
app/views/wiki/show.html.erb:78:in `_app_views_wiki_show_html_erb**_2658175282881066560_70023256626540’

It was basically impossible to track the error in the database; it has hundreds of projects and wikis. I decided to test the migration from OP2.4 to OP3.0 with an empty database (clean installation of OP2.4) following the guide from https://www.openproject.org/open-source/upgrade-guides/migration-guide-op-2-4-op-3-0/. I created a project and its wiki page with four versions, nothing else. Then I migrated the database to OP3.0 and faced the same error described above. After the failed migration and with the migrated database, I created a new project in OP3.0 similar to the one migrated from OP2.4. The wiki page history of the new project is working fine.
I created a dump of the database to compare both projects. I found that the table “wiki_content_journals” has duplicated entries (from the migration) and field “page_id” has errors; this produces the error in OP3.0.
This is the dump of table “wiki_content_journals”:

TABLE `wiki_content_journals` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`journal_id` int(11) NOT NULL,
`page_id` int(11) NOT NULL,
`author_id` int(11) DEFAULT NULL,
`text` longtext,
)

VALUES
(1,1,1,1,‘h1. Wiki\n\nThis is first version of project 1’s wiki in OP2.4.’)
(2,2,2,1,‘h1. Wiki\n\nThis is first version of project 1’s wiki in OP2.4. Plus second version’)
(3,3,3,1,‘h1. Wiki\n\nThis is first version of project 1’s wiki in OP2.4. Plus second version. Plus third version.’)
(4,4,4,1,‘h1. Wiki\n\nThis is first version of project 1’s wiki in OP2.4. Plus second version. Plus third version. Plus fourth and last version.’)
(5,1,1,1,‘h1. Wiki\n\nThis is first version of project 1’s wiki in OP2.4. Plus second version. Plus third version. Plus fourth and last version.’)
(6,2,1,1,‘h1. Wiki\n\nThis is first version of project 1’s wiki in OP2.4. Plus second version. Plus third version. Plus fourth and last version.’)
(7,3,1,1,‘h1. Wiki\n\nThis is first version of project 1’s wiki in OP2.4. Plus second version. Plus third version. Plus fourth and last version.’)
(8,4,1,1,‘h1. Wiki\n\nThis is first version of project 1’s wiki in OP2.4. Plus second version. Plus third version. Plus fourth and last version.’)
(12,5,2,1,‘h1. Wiki\n\nFirst version of project 2’s wiki in OP3.0.’)
(13,6,2,1,‘h1. Wiki\n\nFirst version of project 2’s wiki in OP3.0. Plus second version’)
(14,7,2,1,‘h1. Wiki\n\nFirst version of project 2’s wiki in OP3.0. Plus second version. Plus third version.’)
(15,8,2,1,‘h1. Wiki\n\nFirst version of project 2’s wiki in OP3.0. Plus second version. Plus third version. Plus fourth and last version.’);

As you can see, the first four rows (wiki_content_journals.id = 1 to 4) have the history of the wiki page of the project created in OP2.4. The field “page_id” is incorrect in these rows; it should be equal to 1.
The next four rows (wiki_content_journals.id = 5 to 8) are replicated rows of last version of the wiki page. In this case the field “page_id” is correct.
The last four rows (wiki_content_journals.id = 12 to 15) belong to the new project created in OP3.0; they have correct information.

I am not sure if it is necessary to give the configuration of OP2.4 and OP3.0 I have been using. I tried with OP3.0.0, OP3.0.8 and OP3.0.17 with the same results.

Did anyone face this problem? I am not familiar with the OP source code and it has been impossible to me to find the error. I just managed to use some SQL queries to try to fix the database. I have been told that there may also be errors with the migration of issues (work packages), but I still do not confirm that.

Thanks in advance for your help.


Loading...