ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Migration trouble

Added by Serg Zhum at 2011-07-14 05:46 pm

Hello!
I try to migrate from Redmine 0.8.9 (mysql, no extra plugins) on Debian to ChiliProject on other machine (debian, ruby-1.8.7). I had backed up my database, restored it on other machine, then git-cloned chiliproject, and done 'bundle install' and other needed things from documentation... All went good, till rake db:migration. It had failed with strange diagnostics:

# RAILS_ENV="production" rake db:migrate
==  BuildProjectsTree: migrating ==============================================
rake aborted!
An error has occurred, all later migrations canceled:

Validation failed: translation missing: en, field_repository is invalid

Tasks: TOP => db:migrate
(See full trace by running task with --trace)


How can I fix it?


Replies (7)

RE: Migration trouble - Added by Felix Schäfer at 2011-07-14 11:03 pm

You obviously already do, but just to make sure: have backups or work on a copy of your original data! :-)

OK, now I guess the main problem here is the relatively big version difference between the two installs, but we should be able to work around that. Could you please post the output of RAILS_ENV="production" rake db:migrate --trace so that we may have a better idea of what exactly goes wrong?

RE: Migration trouble - Added by Serg Zhum at 2011-07-15 04:34 am

Thank you for the fast and optimistic answer :)
Here is output of the first rake run (if it might help):

# RAILS_ENV=production rake db:migrate
==  AddCustomFieldsEditable: migrating ========================================
-- add_column(:custom_fields, :editable, :boolean, {:default=>true})
   -> 0.1240s
==  AddCustomFieldsEditable: migrated (0.1241s) ===============================

==  SetCustomFieldsEditable: migrating ========================================
==  SetCustomFieldsEditable: migrated (0.0029s) ===============================

==  AddProjectsLftAndRgt: migrating ===========================================
-- add_column(:projects, :lft, :integer)
   -> 0.1009s
-- add_column(:projects, :rgt, :integer)
   -> 0.0917s
==  AddProjectsLftAndRgt: migrated (0.1928s) ==================================

==  BuildProjectsTree: migrating ==============================================
rake aborted!
An error has occurred, all later migrations canceled:

Validation failed: translation missing: en, field_repository is invalid

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

And here is traced run:

# RAILS_ENV=production rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
==  BuildProjectsTree: migrating ==============================================
rake aborted!
An error has occurred, all later migrations canceled:

Validation failed: translation missing: en, field_repository is invalid
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/validations.rb:1102:in `save_without_dirty!'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/dirty.rb:87:in `save_without_transactions!'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:200:in `save!'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:182:in `transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:200:in `save!'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/transactions.rb:200:in `save!'
/var/www/ChiliProject/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:186:in `rebuild!'
/var/www/ChiliProject/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:193:in `call'
/var/www/ChiliProject/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:193:in `rebuild!'
/var/www/ChiliProject/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:190:in `each'
/var/www/ChiliProject/chiliproject/vendor/plugins/awesome_nested_set/lib/awesome_nested_set.rb:190:in `rebuild!'
./db/migrate//105_build_projects_tree.rb:16:in `up_without_benchmarks'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:282:in `send'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:282:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:282:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:365:in `__send__'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:365:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:491:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:567:in `call'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:567:in `ddl_transaction'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:490:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:477:in `each'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:477:in `migrate'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:401:in `up'
/var/lib/gems/1.8/gems/activerecord-2.3.12/lib/active_record/migration.rb:383:in `migrate'
/var/lib/gems/1.8/gems/rails-2.3.12/lib/tasks/databases.rake:112
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:205:in `execute'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:158:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/var/lib/gems/1.8/gems/rake-0.9.2/bin/rake:32
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19
Tasks: TOP => db:migrate

RE: Migration trouble - Added by Eric Davis at 2011-07-15 10:11 pm

Can you run and post the output from this? It seems like a Project has an invalid repository:

ruby script/runner -e production 'Project.all.each {|project| project.valid? ? nil : puts("Project ##{project.id}: #{project.errors.full_messages.to_s}") }'

Eric Davis

RE: Migration trouble - Added by Serg Zhum at 2011-07-18 06:20 am

# ruby script/runner -e production 'Project.all.each {|project| project.valid? ? nil : puts("Project ##{project.id}: #{project.errors.full_messages.to_s}") }'
Storing outgoing emails configuration in config/email.yml is deprecated. You should now store it in config/configuration.yml using the email_delivery setting.
Project #2: translation missing: en, field_repository is invalid
How can I find and fix "repository"? May be paths for files are different (they ARE different on old and new machine)? I know rails a little, so I can see appropriate config file or controller code - but I need to know where to watch :)

RE: Migration trouble - Added by Serg Zhum at 2011-07-21 12:43 pm

May be, there is another way to migrate db? I have no plugins on my old redmine installation - only several projects, tickets, users, wikis and documents on fresh installed redmine. Even no repositories, forums and news. May be I can pre-process mysql-dump to new database scheme (e.g. rename fields, add some fields, etc)?

RE: Migration trouble - Added by Eric Davis at 2011-07-22 03:41 pm

Serg Zhum:

Do you have a repository set up for that project? Do you use it?

If you don't, you could delete that repository record and try to run the migrations again.

ruby script/runner -e production "Project.find(2).repository.destroy" 

Eric Davis

RE: Migration trouble - Added by Serg Zhum at 2011-07-25 06:06 am

It helps! But I meet another trouble... Here migration log is attached. The error was:

==  BuildInitialJournalsForActsAsJournalized: migrating =======================
-- Building initial journals for Message
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Unknown column 'members.role_id' in 'field list': SELECT `members`.`id` AS t0_r0, `members`.`user_id` AS t0_r1, `members`.`project_id` AS t0_r2, `members`.`role_id` AS t0_r3, `members`.`created_on` AS t0_r4, `members`.`mail_notification` AS t0_r5, `users`.`id` AS t1_r0, `users`.`login` AS t1_r1, `users`.`hashed_password` AS t1_r2, `users`.`firstname` AS t1_r3, `users`.`lastname` AS t1_r4, `users`.`mail` AS t1_r5, `users`.`mail_notification_bool` AS t1_r6, `users`.`admin` AS t1_r7, `users`.`status` AS t1_r8, `users`.`last_login_on` AS t1_r9, `users`.`language` AS t1_r10, `users`.`auth_source_id` AS t1_r11, `users`.`created_on` AS t1_r12, `users`.`updated_on` AS t1_r13, `users`.`type` AS t1_r14, `users`.`identity_url` AS t1_r15, `users`.`mail_notification` AS t1_r16, `roles`.`id` AS t2_r0, `roles`.`name` AS t2_r1, `roles`.`position` AS t2_r2, `roles`.`assignable` AS t2_r3, `roles`.`builtin` AS t2_r4, `roles`.`permissions` AS t2_r5 FROM `members`  LEFT OUTER JOIN `users` ON `users`.id = `members`.user_id AND  (`users`.`type` = 'User' OR `users`.`type` = 'AnonymousUser' )  LEFT OUTER JOIN `member_roles` ON (`members`.`id` = `member_roles`.`member_id`)  LEFT OUTER JOIN `roles` ON (`roles`.`id` = `member_roles`.`role_id`) WHERE (`members`.project_id = 14 AND (users.type='User' AND users.status=1)) 

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Can I fix something to finish my migration? :)

chili1.txt - migration log after repository deletion (19 kB)

(1-7/7)