Error during "rake db:migrate RAILS_ENV="production"" when updating to latest trunk (3556 to 3586)

Added by Albrecht Backhaus over 11 years ago

Hello, when running "rake db:migrate RAILS_ENV="production"" after update to latest trunk I get the following error:

==  AddIssuesNestedSetsColumns: migrating =====================================
-- add_column(:issues, :parent_id, :integer, {:default=>nil})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Duplicate column name 'parent_id': ALTER TABLE `issues` ADD `parent_id` int(11) DEFAULT NULL

Any help is highly appreciated.

Regards, Albrecht

Replies (6)

RE: Error during "rake db:migrate RAILS_ENV="production"" when updating to latest trunk (3556 to 3586) - Added by Henrik Ammer over 11 years ago

I had to remove lines from the 20100313132032_add_issues_nested_sets_columns.rb file (located in db/migrate) to get the migrate to work properly. I wonder if something was missed in the update that these columns where already in the database?

First do a dump of your database (just to make sure), then remove the add_column :issues, parent_id line from the file mentioned above (dunno exactly how the line was written since I have removed them).

Do the upgrade again. If it says that root_id or something else is already in the database, remove that line until you probably have removed all four of them (but run it just to make sure).

Now you devs can tell us how bad we just were by removing stuff, but it solved my problem. :)

RE: Error during "rake db:migrate RAILS_ENV="production"" when updating to latest trunk (3556 to 3586) - Added by Albrecht Backhaus over 11 years ago

No, I do not.
I have several plugins installed but not the subtask plugin.

RE: Error during "rake db:migrate RAILS_ENV="production"" when updating to latest trunk (3556 to 3586) - Added by Albrecht Backhaus over 11 years ago

Here is the list of the installed plugins:
  • Bulk Time Entry 0.5.0
  • Google Analytics plugin 0.2.0
  • Redmine Question plugin 0.3.0
  • Redmine Todo Lists plugin 0.0.3.9
  • Redmine Wiki Extensions plugin 0.2.0
  • Redmine System Notification plugin 0.2.0
  • Timesheet Plugin 0.5.0

RE: Error during "rake db:migrate RAILS_ENV="production"" when updating to latest trunk (3556 to 3586) - Added by Henrik Ammer over 11 years ago

I don't have the subtask either installed but have had it in the past.

If this breaks the update procedure it might be a good idea to start checking for the columns before adding them since I think there could be a number of users that have had it installed previously and it will break the migrate when 0.9.4 comes out.

RE: Error during "rake db:migrate RAILS_ENV="production"" when updating to latest trunk (3556 to 3586) - Added by Albrecht Backhaus over 11 years ago

Got help in the Redmine IRC channel in the meantime. Issue was caused by a former install of the subtasks plugin. (which I couldn't remember ...)

I needed to remove lines from the 20100313132032_add_issues_nested_sets_columns.rb file as already described by Henrik Jönsson above.

Thanks to Eric Davies for his help.

(1-6/6)