Failed to upgrade to 3.4.2
Added by hugo joe about 7 years ago
System: Debian7, postgresql 9.1
Today I failed to upgrade redmine 3.3.0 straight to 3.4.2. But worked to upgrade to 3.3.4.
Then I failed to upgrade redmine 3.3.4 to 3.4.2. Got the same error message when database update(bundle exec rake db:migrate RAILS_ENV=production):
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
Index name 'index_issues_on_parent_id' on table 'issues' already exists
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:954:in `add_index_options'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/connection_adapters/postgresql/schema_statements.rb:487:in `add_index'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:665:in `block in method_missing'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:634:in `block in say_with_time'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:634:in `say_with_time'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:654:in `method_missing'
/opt/redmine34/db/migrate/20161220091118_add_index_on_issues_parent_id.rb:3:in `change'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:608:in `exec_migration'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:591:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:590:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:768:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/transactions.rb:220:in `transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:1044:in `ddl_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:959:in `block in migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:955:in `each'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:955:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:823:in `up'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/migration.rb:801:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.8/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Regards.
Hugo
Replies (3)
RE: Failed to upgrade to 3.4.2 - Added by Guillermo ML about 7 years ago
The index in issues.parent_id was added in 3.4.0 (Feature #23987)
Maybe the failed upgrade from 3.3.0 to 3.4.2 left that index on the database.
Try to drop that index first and then perform the upgrade.
RE: Failed to upgrade to 3.4.2 - Added by hugo joe about 7 years ago
Thanks for your reply :)
Maybe the index was from installed plugin Agile(https://www.redmineup.com/pages/plugins/agile)
(All installed plugins: redmine_agile, redmine_checklists, redmine_work_time)
Can you tell me how to drop it from table 'issues'?
Ps. What I have is a sqlc file through pg_dump.
Regards.
Hugo
RE: Failed to upgrade to 3.4.2 - Added by hugo joe about 7 years ago
Thank you, Guillermo.
The problem resolved.
su - postpres psql
/c databasename;
drop index index_issues_on_parent_id;
Regards.
Hugo