Project

General

Profile

migrate abort with Mysql error, on step AddRolePosition

Added by cheng huang over 12 years ago

Hello everybody.
I new to install the redmine on my QNAP NAS system 459u.
--------------------------------------------------------------------------------------------------------
redmine: 1.3.0
ruby: 1.8.7
rake: 0.9.2.2
gem: 1.3.7
rails: 2.3.14
i18n: 0.4.2
ruby-mysql: 2.8.1
rack: 1.1.2
MySql: 5.1.36
Linux:2.6.33.2 (root@NasX86-5) (gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)) #1 SMP Sat Nov 26 02:56:52 CST 2011
--------------------------------------------------------------------------------------------------------

I followed instruction of http://www.redmine.org/projects/redmine/wiki/RedmineInstall
and passed steps until "RAILS_ENV=production rake db:migrate"
It stuck on AddRolePosition

following error be showed:
--------------------------------------------------------------------------------------------------------
AddRolePosition: migrating ==============================================
-- add_column(:roles, :position, :integer, {:default=>1})
-> 0.3154s
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: You can't specify target table 'roles' for update in FROM clause: UPDATE `roles` SET position = (SELECT COUNT FROM roles r WHERE r.id < id) + 1
--------------------------------------------------------------------------------------------------------

When I run migrate again, then another error:
--------------------------------------------------------------------------------------------------------
AddRolePosition: migrating ==============================================
-- add_column(:roles, :position, :integer, {:default=>1})
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Duplicate column name 'position': ALTER TABLE `roles` ADD `position` int(11) DEFAULT 1
--------------------------------------------------------------------------------------------------------

It is looks like sql query error.
Anyone knows about this issue solution?

Thank you.


Replies (4)

RE: migrate abort with Mysql error, on step AddRolePosition - Added by leonardo lazzaro over 12 years ago

I also have a similar problem with trunk code.

Mysql::Error: You can't specify target table 'roles' for update in FROM clause: UPDATE `roles` SET position = (SELECT COUNT FROM roles r WHERE r.id < id) + 1

    (1-4/4)