ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Migration error importing from old version of redmine to Chiliproject v2.0 (Bug #508)


Added by Wari Wahab at 2011-07-06 06:33 am. Updated at 2011-07-09 10:12 pm.


Status:Declined Start date:2011-07-06
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:Journals / History
Target version:-
Remote issue URL: Affected version:2.0.0

Description

Hi there, I was running from version 0.8 or earlier of the old redmine, and tried to import it into chiliproject. I got this error from db:migrate:

UpdateJournalsForActsAsJournalized: migrating ===========================
-- Updating existing Journals...
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Unknown column 'projects.projects_count' in 'field list': SELECT `versions`.`id` AS t0_r0, `versions`.`project_id` AS t0_r1, `versions`.`name` AS t0_r2, `versions`.`description` AS t0_r3, `versions`.`effective_date` AS t0_r4, `versions`.`created_on` AS t0_r5, `versions`.`updated_on` AS t0_r6, `versions`.`wiki_page_title` AS t0_r7, `versions`.`status` AS t0_r8, `versions`.`sharing` AS t0_r9, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`projects_count` AS t1_r6, `projects`.`created_on` AS t1_r7, `projects`.`updated_on` AS t1_r8, `projects`.`identifier` AS t1_r9, `projects`.`status` AS t1_r10, `projects`.`lft` AS t1_r11, `projects`.`rgt` AS t1_r12 FROM `versions` LEFT OUTER JOIN `projects` ON `projects`.id = `versions`.project_id WHERE ((`versions`.`status` = 'open') AND (projects.id = 2 OR (projects.status = 1 AND ( versions.sharing = 'system' OR (projects.lft >= 3 AND projects.rgt <= 8 AND versions.sharing = 'tree') OR (projects.lft < 3 AND projects.rgt > 8 AND versions.sharing IN ('hierarchy', 'descendants')) OR (projects.lft > 3 AND projects.rgt < 8 AND versions.sharing = 'hierarchy')))))

I've got several options to ensure a successful import:

  • Run db:migrate again (somehow it works),
UpdateJournalsForActsAsJournalized: migrating ===========================
-- Updating existing Journals...
> 103.1974s
-
change_table(:journals)
-> 0.2146s
UpdateJournalsForActsAsJournalized: migrated (103.4123s) ================
  • or, reimport the DB again,
    - git checkout v1.5.0
    - rake db:migrate
    - git checkout stable
    - rake db:migrate

Both options does provide a running chiliproject instance. Though I'm wondering which one I should go with.


History

Updated by Wari Wahab at 2011-07-06 06:45 am

BTW, when going into chiliproject 2.0.0, acts_as_versioned plugin is no longer there, so the migrate quits with:

BuildInitialJournalsForActsAsJournalized: migrating =====================
-- Building initial journals for Message
> 1.7389s
-
Building initial journals for Attachment
rake aborted!
An error has occurred, all later migrations canceled:

undefined method `acts_as_versioned' for #<Class:0x7f64c4af48f0>

----
Unless I put that plugin back to ensure a successful migration.

Updated by Felix Schäfer at 2011-07-06 08:53 am

(What the hell, I'm pretty sure I had posted here!?)

acts_as_versioned has been replaced by acts_as_journalized, if you get errors of some code calling acts_as_versioned in 2.0, you either have a plugin that needs upgrading, or some files haven't been upgraded correctly on your installation. I just checked on my local development 2.0 installation, and there's no mention of acts_as_versioned.

Updated by Wari Wahab at 2011-07-06 09:14 am

After poking around, acts_as_versioned is needed by the ezfaq_plugin (and gloc?) from the old install. I removed all traces of faq from the sqldump by hand, which means quite a bit of a data loss on my side, and the import works fine (with the exception of the projects.projects_count error, that still happens).

It looks like the latest greatest copy of ezfaq needs acts_as_versioned:

https://github.com/ansoncat/ezfaq_plugin/blob/master/app/models/faq.rb

So will adding acts_as_versioned plugin affect chilliproject in a bad way?

Updated by Felix Schäfer at 2011-07-06 12:37 pm

Wari Wahab wrote:

After poking around, acts_as_versioned is needed by the ezfaq_plugin (and gloc?) from the old install.

I think gloc is the way way old way of doing translations in rails pre-2.3 (and probably even pre-that), i.e. that shouldn't be needed anymore.

I removed all traces of faq from the sqldump by hand, which means quite a bit of a data loss on my side,

I don't think the data bothers anyone when it's in the database and in its own tables and so on. One way to revert migrations from plugins (if those plugins are coded correctly): rake db:migrate:plugin NAME=redmine_ez_faq VERSION=0 (that's from memory but should at least resemble the correct version…), this way you don't have to remove it by hand…

and the import works fine (with the exception of the projects.projects_count error, that still happens).

Mmh, the only mention I can find it is in the setup and a later migration in which projects_count is removed. In other words, it shouldn't be there, and probably even not any more in Redmine 0.8. Now, the error you have seems to come from some part of your install still trying to read it, so either some of your files haven't been upgraded properly, or a plugin is looking for it. Anyway, you know the drill ;-)

It looks like the latest greatest copy of ezfaq needs acts_as_versioned:

https://github.com/ansoncat/ezfaq_plugin/blob/master/app/models/faq.rb

So will adding acts_as_versioned plugin affect chilliproject in a bad way?

Well, even if adding acts_as_versioned back doesn't cause any immediate problem, it will only postpone it.

Now, and take all that with a huge grain of salt as I haven't tried or tested any of this: adding it back probably won't hurt, but you might get funny errors on the activity page, and the faq activity entries will not show. Can't guarantee nothing else won't break either.

I've added Tim (who wrote most of the acts_as_journalized code) and Eric (spent enough time with the code ;-) ), maybe they can/want to chime in too.

Eric: I think we should also make a page for plugins that are known to not work.

Updated by Eric Davis at 2011-07-06 11:05 pm

Wari Wahab:

How old of a version of Redmine did you upgrade from? (exact svn revision or git sha would be best)

From your original question about re-running the migration: I think either one would work. I'm guessing the first time it ran (the one with the error) some classes were loaded by the migrations (adding or removing the projects_count column) and by the time UpdateJournalsForActsAsJournalized was run those classes where changed so projects_count wasn't present anymore. Re-running the migration then worked because there wasn't any classes cached.

I think upgrading the ezfaq plugin to use the new acts_as_journalized would be a good long term solution. It could then remove a lot of it's custom code (FaqVersion).

Felix:

I think we should also make a page for plugins that are known to not work.

Good idea. We can do simple lists of "Untested", "Known working" (or "Known working at this fork"), and "Not working". This would also be good to have a plugin directory for...

  • Category set to Journals / History
  • (deleted custom field) set to 2.0.0

Updated by Felix Schäfer at 2011-07-08 08:12 pm

Eric Davis wrote:

I think we should also make a page for plugins that are known to not work.

Good idea. We can do simple lists of "Untested", "Known working" (or "Known working at this fork"), and "Not working". This would also be good to have a plugin directory for…

See Plugin Compatibility, I started the list the other way round though (Plugin > Version > compatible with), as most of the time you don't want to plodge through the whole history of ChiliProject to look for the plugins you're interested in.

Updated by Felix Schäfer at 2011-07-08 09:33 pm

Declining this as it is a plugin issue.

Regarding migrating the plugin to acts_as_journalized, we have an internal plugin which used acts_as_versioned and that I have ported, might be able to produce a patch for ezfaq_plugin if it is popular, the biggest problem I have with the plugin currently is that there is no "official" maintainer though…

  • Status changed from Open to Declined

Updated by Wari Wahab at 2011-07-08 09:56 pm

and the import works fine (with the exception of the projects.projects_count error, that still happens).

Mmh, the only mention I can find it is in the setup and a later migration in which projects_count is removed. In other words, it shouldn't be there, and probably even not any more in Redmine 0.8. Now, the error you have seems to come from some part of your install still trying to read it, so either some of your files haven't been upgraded properly, or a plugin is looking for it. Anyway, you know the drill ;-)

Thing is, all I did to get the error is to just:

  • git clone chiliproject
  • mysql -p -u chiliproject < olddump.sql
  • rake db:migrate # projects_count error
  • rake db:migrate # error goes away

Updated by Felix Schäfer at 2011-07-08 10:21 pm

Wari Wahab wrote:

Thing is, all I did to get the error is to just:

  • git clone chiliproject
  • mysql -p -u chiliproject < olddump.sql
  • rake db:migrate # projects_count error
  • rake db:migrate # error goes away

See Eric's answer in the second paragraph of note 5 about this. It's "normal" that it happens the first time because you're coming from a fairly old Redmine, and it's "normal" that it works the second time, it goes on from where it left and broke the first time.

Updated by Wari Wahab at 2011-07-08 10:34 pm

Thanks for the clarification. So far, the installation looked fine on my side, sans the ezfaq plugin. I'm getting people to test it out.

I'm not sure about the ezfaq bit though, but if a patch to ezfaq is as simple as replacing acts_as_versioned to acts_as_journalized it would be great, but I doubt it would be that easy, right?

Updated by Felix Schäfer at 2011-07-09 10:12 pm

Wari Wahab wrote:

I'm not sure about the ezfaq bit though, but if a patch to ezfaq is as simple as replacing acts_as_versioned to acts_as_journalized it would be great, but I doubt it would be that easy, right?

  1. not that easy,
  2. as I said, I won't do it unless there is a maintainer committed to the plugin, even better if he is committed to maintaining it not only for Redmine.

Also available in: Atom PDF