Project

General

Profile

Migrate db from old Redmine v1.1.2 to 3.0.3

Added by Maor Barazany over 6 years ago

Hi,

I have a db dump of my old redmine 1.1.2 and I have another server with Redmine 3.0.3 installed and working (I know it's not the latest version).
My old server crashed, so I have only sql dump and the files, but the old Redmine is not running anymore.

I have default install of Redmine on that server, and it is working well, attached also to a new domain. All working, but no data yet.

Then I moved the old database sql dump to the new Redmine server (I mysqldump'ed it from old one, and imported it to the new server instead of the empty data redmine db that was there after the installetion).
After that I changed in the database table the column of 'host' to be the new host.

I followed this upgrade procedure -
RedmineUpgrade

But on step 4 of upgrading the db, I got error that a table already exists:

== 20110902000000 CreateChangesetParents: migrating ===========================
-- create_table(:changeset_parents, {:id=>false})
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Mysql2::Error: Table 'changeset_parents' already exists: CREATE TABLE `changeset_parents` (`changeset_id` int(11) NOT NULL, `parent_id` int(11) NOT NULL) ENGINE=InnoDB/usr/local/rvm/gems/ruby-2.0.0-p643/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `query'

Here's extra data from RAILS_ENV=production bin/about

sh: 1: darcs: not found
sh: 1: hg: not found
sh: 1: cvs: not found
sh: 1: bzr: not found
sh: 1: git: not found
Environment:
  Redmine version                3.0.3.stable.14369
  Ruby version                   2.0.0-p643 (2015-02-25) [x86_64-linux]
  Rails version                  4.2.2
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.8
  Filesystem
Redmine plugins:
  no plugin installed

installed on Ubuntu 14.04
MYSQL 5.5.43

The front end in this situation return server 500 error, and not working anymore.
How can the db be migrated properly between these versions, so the new redmine 3.0.3 will be available and with the whole data/issues/users etc. of the old 1.2.2 version?

Thanks alot,
Maor


Replies (1)

RE: Migrate db from old Redmine v1.1.2 to 3.0.3 - Added by Maor Barazany over 6 years ago

Well, I managed to fix this! I will reply myself here so it maybe will help someone else.
After you installed fresh copy of Redmine, and it is working with no data, so in order to import your data, you MUST DROP the default redmine database BEFORE you import your database to server. Since if you just import it, there will might stay some new tables, and the rake db migration will fail in this set.
If you first drop the deafult redmine table, then you create it again and import your redmine database, and then do the db migrate - and it worked for me!
I was struggling with this for long days!

    (1-1/1)