Project

General

Profile

Actions

Bug #17474

closed

db:import_dump does not clean existing database prior to re-importing

Added by Ohad Levy over 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

It might be lack of my understanding / docs, but trying to use backup and restore on another server, the sequence that I've done was:

1. backup old server (as described in the manual)
2. create a new server, run foreman installer (so new database gets created) followed by a db restore (and recovering /etc/foreman and puppet ssl dir).

at that point, the recovery fails, as the existing database already is migrated (even if its the same version) so fk errors are present, for example:

pg_restore: [archiver (db)] could not execute query: ERROR:  constraint "tokens_host_id_fk" for relation "tokens" already exists
    Command was: ALTER TABLE ONLY tokens
    ADD CONSTRAINT tokens_host_id_fk FOREIGN KEY (host_id) REFERENCES hosts(id);

the solution was to add --clean to the backup rake task prior.


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #17488: Add confirmation step to db:import taskClosedDaniel Lobato Garcia11/25/2016Actions
Actions #1

Updated by The Foreman Bot over 7 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ohad Levy
  • Pull request https://github.com/theforeman/foreman/pull/4046 added
Actions #2

Updated by Daniel Lobato Garcia over 7 years ago

  • Related to Bug #17488: Add confirmation step to db:import task added
Actions #3

Updated by Ohad Levy over 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #4

Updated by Dominic Cleal over 7 years ago

  • translation missing: en.field_release set to 189
Actions

Also available in: Atom PDF