Project

General

Profile

Actions

Defect #9800

closed

Migration error rake db:migrate RAILS_ENV="production"

Added by leonardo lazzaro over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I just updated trunk code.
when I run the command in a clean db.

rake db:migrate RAILS_ENV="production" 

I get the following error

==  AddRolePosition: migrating ================================================
-- add_column(:roles, :position, :integer, {:default=>1})
   -> 0.3130s
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 

Tasks: TOP => db:migrate

Env info

About your application's environment
Ruby version              1.8.7 (i486-linux)
RubyGems version          1.3.7
Rack version              1.1.2
Rails version             2.3.14
Active Record version     2.3.14
Active Resource version   2.3.14
Action Mailer version     2.3.14
Active Support version    2.3.14
Application root          /var/www/redmine
Environment               production
Database adapter          mysql
Database schema version   19

thanks

Actions #1

Updated by leonardo lazzaro over 12 years ago

Actions #2

Updated by Jean-Philippe Lang over 12 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Fixed in r8213. You'll have to recreate your database.

Actions

Also available in: Atom PDF