Actions
Defect #19721
closedUpgrade from 2.6.4 to 3.0.2 fails with Mysql2::Error: Table 'email_addresses' already exists:
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Invalid
Affected version:
Description
I started with a working Redmine 2.6.4 installation on an Ubuntu 12.04 LTS box with Ruby 1.8.7. These are the steps I took in my attempt to upgrade to Redmine 3.0.2:
apt-get install ruby1.9.3 -y
apt-get remove ruby1.8 ruby1.8-dev -y
cd /opt/redmine
svn sw http://svn.redmine.org/redmine/tags/3.0.2
sed -i 's/adapter: mysql/adapter: mysql2/g' /opt/redmine/config/database.yml
gem install bundle
bundle update
rm -f config/initializers/secret_token.rb
bundle exec rake generate_secret_token
bundle exec rake db:migrate RAILS_ENV=production --trace
bundle exec rake tmp:cache:clear
bundle exec rake tmp:sessions:clear
chown -R www-data /opt/redmine
chmod +x /opt/redmine/extra/mail_handler/rdm-mailhandler.rb
I didn't make it past step 10:
bundle exec rake db:migrate RAILS_ENV=production --trace
** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Execute db:load_config ** Execute db:migrate == 20141029181752 AddTrackersDefaultStatusId: migrating ======================= -- add_column(:trackers, :default_status_id, :integer) -> 0.0211s == 20141029181752 AddTrackersDefaultStatusId: migrated (0.0843s) ============== == 20141029181824 RemoveIssueStatusesIsDefault: migrating ===================== -- remove_column(:issue_statuses, :is_default) -> 0.0170s == 20141029181824 RemoveIssueStatusesIsDefault: migrated (0.0172s) ============ == 20141109112308 AddRolesUsersVisibility: migrating ========================== -- add_column(:roles, :users_visibility, :string, {:limit=>30, :default=>"all", :null=>false}) -> 0.0176s == 20141109112308 AddRolesUsersVisibility: migrated (0.0179s) ================= == 20141122124142 AddWikiRedirectsRedirectsToWikiId: migrating ================ -- add_column(:wiki_redirects, :redirects_to_wiki_id, :integer) -> 0.0183s -- change_column(:wiki_redirects, :redirects_to_wiki_id, :integer, {:null=>false}) -> 0.0195s == 20141122124142 AddWikiRedirectsRedirectsToWikiId: migrated (0.0467s) ======= == 20150113194759 CreateEmailAddresses: migrating ============================= -- create_table(:email_addresses) rake aborted! StandardError: An error has occurred, all later migrations canceled: Mysql2::Error: Table 'email_addresses' already exists: CREATE TABLE `email_addresses` (`id` int(11) auto_increment PRIMARY KEY, `user_id` int(11) NOT NULL, `address` varchar(255) NOT NULL, `is_default` tinyint(1) DEFAULT 0 NOT NULL, `notify` tinyint(1) DEFAULT 1 NOT NULL, `created_on` datetime NOT NULL, `updated_on` datetime NOT NULL) ENGINE=InnoDB/var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `query' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `block in execute' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log' /var/lib/gems/1.9.1/gems/activesupport-4.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `execute' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:208:in `create_table' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:462:in `create_table' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:662:in `block in method_missing' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `block in say_with_time' /usr/lib/ruby/1.9.1/benchmark.rb:280:in `measure' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:632:in `say_with_time' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:652:in `method_missing' /opt/redmine/db/migrate/20150113194759_create_email_addresses.rb:3:in `change' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:606:in `exec_migration' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:590:in `block (2 levels) in migrate' /usr/lib/ruby/1.9.1/benchmark.rb:280:in `measure' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:589:in `block in migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:588:in `migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:765:in `migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:995:in `block in execute_migration_in_transaction' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:1043:in `ddl_transaction' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:994:in `execute_migration_in_transaction' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:956:in `block in migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `each' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:952:in `migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:820:in `up' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/migration.rb:798:in `migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:137:in `migrate' /var/lib/gems/1.9.1/gems/activerecord-4.2.1/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `call' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `each' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain' /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `each' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling' /var/lib/gems/1.9.1/gems/rake-10.4.2/lib/rake/application.rb:75:in `run' /var/lib/gems/1.9.1/gems/rake-10.4.2/bin/rake:33:in `<top (required)>' /usr/local/bin/rake:19:in `load' /usr/local/bin/rake:19:in `<main>' Tasks: TOP => db:migrate
bundle list
Gems included by the bundle: * actionmailer (4.2.1) * actionpack (4.2.1) * actionpack-action_caching (1.1.1) * actionpack-xml_parser (1.0.2) * actionview (4.2.1) * activejob (4.2.1) * activemodel (4.2.1) * activerecord (4.2.1) * activesupport (4.2.1) * arel (6.0.0) * builder (3.2.2) * bundler (1.9.4) * coderay (1.1.0) * daemon_controller (1.2.0) * erubis (2.7.0) * globalid (0.3.5) * i18n (0.7.0) * jquery-rails (3.1.2) * json (1.8.2) * loofah (2.0.1) * mail (2.6.3) * mime-types (2.5) * mini_portile (0.6.2) * minitest (5.6.1) * mysql2 (0.3.18) * net-ldap (0.3.1) * nokogiri (1.6.6.2) * passenger (4.0.57) * protected_attributes (1.0.9) * rack (1.6.0) * rack-openid (1.4.2) * rack-test (0.6.3) * rails (4.2.1) * rails-deprecated_sanitizer (1.0.3) * rails-dom-testing (1.0.6) * rails-html-sanitizer (1.0.2) * railties (4.2.1) * rake (10.4.2) * rbpdf (1.18.5) * rdoc (4.2.0) * redcarpet (3.1.2) * request_store (1.0.5) * rmagick (2.13.4) * ruby-openid (2.3.0) * sprockets (3.0.3) * sprockets-rails (2.2.4) * thor (0.19.1) * thread_safe (0.3.5) * tzinfo (1.2.2) * yard (0.8.7.6)
Actions