Defect #5723

Error db:migrate with rails=2.3.8

Added by Mike Stupalov about 10 years ago. Updated over 8 years ago.

Status:ClosedStart date:2010-06-22
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Database
Target version:-
Resolution:Invalid Affected version:

Description

I use environment:

Ruby version              1.8.7 (amd64-freebsd8)
RubyGems version          1.3.7
Rack version              1.1
Rails version             2.3.8
Active Record version     2.3.8
Active Resource version   2.3.8
Action Mailer version     2.3.8
Active Support version    2.3.8
Application root          /usr/local/www/redmine
Environment               production
Database adapter          postgresql
Database schema version   20100323105501

At initial installation of base (db:migrate) there was an error:

$ RAILS_ENV=production rake db:migrate
(in /usr/local/www/redmine)
...(skipped lines)
==  CreateWikis: migrating ====================================================
-- create_table(:wikis)
NOTICE:  CREATE TABLE will create implicit sequence "wikis_id_seq" for serial column "wikis.id" 
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "wikis_pkey" for table "wikis" 
   -> 0.0137s
-- add_index(:wikis, :project_id, {:name=>:wikis_project_id})
rake aborted!
An error has occurred, this and all later migrations canceled:

undefined method `length' for :wikis_project_id:Symbol

(See full trace by running task with --trace)

I have viewed a code of creation of base and have found syntax errors in add_index and remove_index. Options ":name" are specified with a colon, and there should be commas:

-    add_index :wikis, :project_id, :name => :wikis_project_id
+    add_index :wikis, :project_id, :name => "wikis_project_id" 

(As it is written in documentation Class ActiveRecord::Migration)

db_migrate.patch Magnifier - DB migrate patch for rails 2.3.8 (11.6 KB) Mike Stupalov, 2010-06-22 13:40

0001-Make-sure-name-in-enclosed-in-quotation-marks.patch Magnifier (13.6 KB) Torgny Nyblom, 2010-12-27 12:32


Related issues

Duplicated by Redmine - Defect #6051: undefined method `length' for :changesets_repos_scmid:Symbol Closed 2010-08-06

History

#1 Updated by Felix Schäfer about 10 years ago

Rails 2.3.8 is unsupported as of zet, keeping open for the time we do though.

#2 Updated by Torgny Nyblom over 9 years ago

Updated patch that covers the destruction as well as the creation of the db.

#3 Updated by Etienne Massip over 8 years ago

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

Also available in: Atom PDF