Project

General

Profile

Actions

Defect #5505

closed

Migration 0.7.3 -> 0.9.3 fails with BuildProjectsTree: migrating

Added by Cedric Jeanneret almost 14 years ago. Updated almost 14 years ago.

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

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Hello,

We have an old 0.7.3 redmine version, with postgresql-8.3 backend. We'd like to upgrade it to 0.9.3, but unfortunately, db upgrade crashes :

[code]
rake db:migrate RAILS_ENV=production --trace
(in /usr/share/redmine)
  • Invoke db:migrate (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute db:migrate
    AddCustomFieldsEditable: migrating ======================================
    -- add_column(:custom_fields, :editable, :boolean, {:default=>true})
    -> 0.0015s
    AddCustomFieldsEditable: migrated (0.0017s) =============================
SetCustomFieldsEditable: migrating ======================================
SetCustomFieldsEditable: migrated (0.0029s) ============================= AddProjectsLftAndRgt: migrating =========================================
-- add_column(:projects, :lft, :integer)
> 0.0006s
-
add_column(:projects, :rgt, :integer)
-> 0.0004s
AddProjectsLftAndRgt: migrated (0.0014s) ================================ BuildProjectsTree: migrating ============================================
rake aborted!
An error has occurred, this and all later migrations canceled:

Validation failed: Homepage is too long (maximum is 255 characters)
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/validations.rb:1021:in `save_without_dirty!'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/dirty.rb:87:in `save_without_transactions!'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:150:in `save!'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:550:in `transaction'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:129:in `transaction'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:150:in `save!'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:158:in `rollback_active_record_state!'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:150:in `save!'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:186:in `rebuild!'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:183:in `call'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:183:in `rebuild!'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:183:in `each'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:183:in `rebuild!'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:193:in `call'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:193:in `rebuild!'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:190:in `each'
/usr/share/redmine/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:190:in `rebuild!'
./db/migrate//105_build_projects_tree.rb:3:in `up_without_benchmarks'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:280:in `send'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:280:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:280:in `migrate'
(DELEGATION):2:in `__send__'
(DELEGATION):2:in `migrate'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:480:in `migrate'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:554:in `call'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:554:in `ddl_transaction'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:550:in `transaction'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/transactions.rb:129:in `transaction'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:554:in `ddl_transaction'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:479:in `migrate'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:466:in `each'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:466:in `migrate'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:394:in `up'
/usr/share/redmine/vendor/rails/activerecord/lib/active_record/migration.rb:377:in `migrate'
/usr/share/redmine/vendor/rails/railties/lib/tasks/databases.rake:111
/usr/lib/ruby/1.8/rake.rb:636:in `call'
/usr/lib/ruby/1.8/rake.rb:636:in `execute'
/usr/lib/ruby/1.8/rake.rb:631:in `each'
/usr/lib/ruby/1.8/rake.rb:631:in `execute'
/usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:583:in `invoke'
/usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2029:in `each'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2023:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2001:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:28
[/code]

I tried to do it step by step, using the migration to 0.8.3 (success), 0.8.7 (success)... but as soon as I begin with 0.9.x, it fails.

Here are some informations about the system :
[code]
ruby script/about
About your application's environment
Ruby version 1.8.7 (i486-linux)
RubyGems version 1.2.0
Rails version 2.2.3
Active Record version 2.2.3
Action Pack version 2.2.3
Active Resource version 2.2.3
Action Mailer version 2.2.3
Active Support version 2.2.3
Edge Rails revision unknown
Application root /usr/share/redmine
Environment development
Database adapter postgresql
Database schema version 101

psql --version
psql (PostgreSQL) 8.3.9
contains support for command-line editing
[/code]

If I just show up the "projects" table structure :
[code]
\d projects;
Table "public.projects"
Column | Type | Modifiers
----------------+-----------------------------+-------------------------------------------------------
id | integer | not null default nextval('projects_id_seq'::regclass)
name | character varying(30) | not null default ''::character varying
description | text |
homepage | character varying(255) | default ''::character varying
is_public | boolean | not null default true
parent_id | integer |
projects_count | integer | default 0
created_on | timestamp without time zone |
updated_on | timestamp without time zone |
identifier | character varying(40) |
status | integer | not null default 1
lft | integer |
rgt | integer |
Indexes:
"projects_pkey" PRIMARY KEY, btree (id)
"unique_name" UNIQUE, btree (name)
[/code]

I just saw that the size of "homepage" has changed in 001_setup.rb:
[code]
create_table "projects", :force => true do |t|
t.column "name", :string, :limit => 30, :default => "", :null => false
t.column "description", :string, :default => "", :null => false
t.column "homepage", :string, :limit => 60, :default => ""
t.column "is_public", :boolean, :default => true, :null => false
t.column "parent_id", :integer
t.column "projects_count", :integer, :default => 0
t.column "created_on", :timestamp
t.column "updated_on", :timestamp
end
[/code]

Maybe there's a problem here ?

Thank you for your work and your help.

Best regards,

C.

Actions #1

Updated by Cedric Jeanneret almost 14 years ago

Hello,

Any news in here ? It's really blocking us in our upgrade process... Any way to pass over this error ?

Thank you.

Actions #2

Updated by Felix Schäfer almost 14 years ago

Cedric Jeanneret wrote:

Validation failed: Homepage is too long (maximum is 255 characters)

Your problem is there, you seem to have a project with a homepage string longer than 255 characters. Find it, shorten it, and it should migrate fine.

Actions #3

Updated by Cedric Jeanneret almost 14 years ago

Felix Schäfer wrote:

Cedric Jeanneret wrote:

Validation failed: Homepage is too long (maximum is 255 characters)

Your problem is there, you seem to have a project with a homepage string longer than 255 characters. Find it, shorten it, and it should migrate fine.

Well, that I could guess. But what if we cannot shorten it ? It seems to contain URLs. Is there a real reason why this field (and others in fact) have been shorten to 60 chars ?

Actions #4

Updated by Felix Schäfer almost 14 years ago

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

I have `homepage` varchar(255) default '' in my DB, so I guess it gets upped by a later migration. Anyway, the error you get is not database-related but validation-related (in the project model). Not sure why it borks now where it didn't before, but your homepage string has to be shorter than 255 characters for the upgrade to proceed.

If you need longer homepage strings, please file a feature request. If you still have problems with your upgrade, please post to the forums as this tracker is not meant for support, thank you.

Actions

Also available in: Atom PDF