Reputation: 438
I migrated our current redmine database content to a new redmine instance on another server, with its own database.
The problem is that when I create something new on my new redmine instance (e.g: a new issue), redmine has internal counters to insert new elements in its database, which end up in primary key collisions because of IDs already existing from my old redmine database.
I solved this by trying to create new elements a number of times high enough to increment the internal counters and avoid primary key collisions.
Does anyone know a proper way to solve this issue? Especially when I have to deal with millions of existing IDs in the database?
Upvotes: 1
Views: 249
Reputation: 55718
Redmine doesn't handle these primary key ids. They are generated by your database instead.
For each table, there is a special counter to generate these IDs on insert. For MySQL, you can set the AUTO_INCREMENT
value of a table. For Postgres, you have to adapt the sequence for the table's primary key using setval
.
Generally, when moving databases from one database server to another, you should make sure to preserve the AUTO_INCREMENT
or sequence values. The common dump tools have options for that.
Upvotes: 1
Reputation: 3420
When Redmine database is moved between two servers, and if version differs it is necessary to perform database upgrade:
It is the following command:
bundle exec rake db:migrate RAILS_ENV=production
If you have installed any plugins, you should also run their database migrations:
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
Upvotes: 0