# Migration to new server not working

**URL:** <https://community.zammad.org/t/migration-to-new-server-not-working/4603>\
**Category:** Technical assistance\
**Created:** [May 12, 2020, 3:20pm UTC](https://community.zammad.org/t/migration-to-new-server-not-working/4603 "2020-05-12T15:20:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahara](https://community.zammad.org/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@sahara](https://community.zammad.org/u/sahara)\
**Post date:** [May 12, 2020, 3:20pm UTC](https://community.zammad.org/t/migration-to-new-server-not-working/4603/1 "2020-05-12T15:20:40Z")

</div>

### Infos:

- Used Zammad version: latest
- Used Zammad installation source: (source, package, …) RPM
- Operating system: CentOS7
- Browser + version: Mozilla

### Expected behavior:

Migration successful  
\*

### Actual behavior:

Migration fails at importing DB  
\*

### Steps to reproduce the behavior:

Hello Community,

I am trying to migrate an existing zammad installation from 2.6.x to a new server. I installed latest version via RPM by using this wiki:

[https://docs.zammad.org/en/latest/install/centos.html](https://docs.zammad.org/en/latest/install/centos.html)

Then I made a backup using this wiki:

[https://docs.zammad.org/en/latest/appendix/backup-and-restore.html#migrating-from-another-zammad-host](https://docs.zammad.org/en/latest/appendix/backup-and-restore.html#migrating-from-another-zammad-host)

Zammad service is disabled and stoped. When restoring the DB i receive errors:

double key value violates unique constraint - Maybe because I tried the restore more than once?

ERROR: Inserting or updating in table “roles\_users” violates foreign key constraint “fk\_rails\_e2a7142459”  
DETAIL: Key (user\_id) = (3) does not exist in the »users« table.

Above error I saw the first time I tried to restore.

What should I do? I assume I must drop the DB now, that does not work as well:

zammad run rake db:drop rake is instantly abborted. I have a snapshot of the machine prior to installing zammad.

Can you please help?

Thank you!

---

<div class="post-metadata">

**Author:** ![sahara](https://community.zammad.org/letter_avatar_proxy/v4/letter/s/9e8a1a/32.png) [@sahara](https://community.zammad.org/u/sahara)\
**Post date:** [May 13, 2020, 5:03pm UTC](https://community.zammad.org/t/migration-to-new-server-not-working/4603/2 "2020-05-13T17:03:04Z")

</div>

So I thing I managed to manually import the DB from a plain text. For this I had to remove one command.  
Unfortunateley I cannot run zammad run rake db\_migrate.

I am attaching the error:

> Blockquote

\*\* Invoke db:migrate (first\_time)  
\*\* Invoke db:load\_config (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:load\_config  
\*\* Execute db:migrate  
== 20190415000001 SettingEsMultiIndex: migrating ==============================  
== 20190415000001 SettingEsMultiIndex: migrated (0.0090s) =====================

== 20190418000000 NormalizeSettingTicketNumberIgnoreSystemId: migrating =======  
== 20190418000000 NormalizeSettingTicketNumberIgnoreSystemId: migrated (0.0147s)

== 20190531180304 InitializeKnowledgeBase: migrating ==========================  
– create\_table(:knowledge\_bases, {:id=\>:integer})  
 → 0.1069s  
– create\_table(:knowledge\_base\_locales, {:id=\>:integer})  
 → 0.0075s  
– create\_table(:knowledge\_base\_translations, {:id=\>:integer})  
 → 0.0065s  
– create\_table(:knowledge\_base\_categories, {:id=\>:integer})  
 → 0.0076s  
– create\_table(:knowledge\_base\_category\_translations, {:id=\>:integer})  
 → 0.0057s  
– create\_table(:knowledge\_base\_answers, {:id=\>:integer})  
 → 0.0140s  
– create\_table(:knowledge\_base\_answer\_translation\_contents, {:id=\>:integer})  
 → 0.0024s  
– create\_table(:knowledge\_base\_answer\_translations, {:id=\>:integer})  
 → 0.0121s  
– create\_table(:knowledge\_base\_menu\_items, {:id=\>:integer})  
 → 0.0080s  
== 20190531180304 InitializeKnowledgeBase: migrated (0.2963s) =================

rake aborted!  
StandardError: An error has occurred, this and all later migrations canceled:

PG::UndefinedTable: FEHLER: Relation »active\_job\_locks« existiert nicht  
LINE 8: WHERE a.attrelid = ‘“active\_job\_locks”’::regc…  
^  
: SELECT a.attname, format\_type(a.atttypid, a.atttypmod),  
pg\_get\_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,  
c.collname, col\_description(a.attrelid, a.attnum) AS comment  
FROM pg\_attribute a  
LEFT JOIN pg\_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum  
LEFT JOIN pg\_type t ON a.atttypid = t.oid  
LEFT JOIN pg\_collation c ON a.attcollation = c.oid AND a.attcollation \<\> t.typcollation  
WHERE a.attrelid = ‘“active\_job\_locks”’::regclass  
AND a.attnum \> 0 AND NOT a.attisdropped  
ORDER BY a.attnum

> Blockquote

zammad run rake db:version  
Current version: 20190531180304

I added the version in the plain text versions, but same error…

---

<div class="post-metadata">

**Author:** ![system](https://community.zammad.org/uploads/default/original/1X/5c5afaea2d23f811dbec33cd4edb02fa29d3262f.png) [@system](https://community.zammad.org/u/system)\
**Post date:** [September 10, 2020, 5:03pm UTC](https://community.zammad.org/t/migration-to-new-server-not-working/4603/3 "2020-09-10T17:03:16Z")

</div>

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.
