Closed denzelem closed 6 months ago
Sounds good, can you prepare a MR for this?
It seems impossible to use --create
with a target database having a different name than the source database.
Another option would be to use dropdb
and createdb
before the pg_restore
command. But you will still get errors like this:
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 6; 2615 2200 SCHEMA public postgres
pg_restore: error: could not execute query: ERROR: schema "public" already exists
Command was: CREATE SCHEMA public;
And you have to verify, if the database exists before you drop it. @brunosedler Any chances this change request can be done by Team A?
Alright, thanks for your work so far. We'll look into it.
Hi @denzelem just a short notice, it will probably take a bit until we'll get around to work on this issue. Hope it's not an urgent problem for you and you can live with your workaround for a bit longer.
Solved by https://github.com/makandra/geordi/pull/213.
Currently geordi restores a PostgreSQL dump with the following options [1]:
When the current database schema and the new database schema differs, you might not be able to run your database migrations [1] after the dump is loaded:
--clean
just drops all tables it knows in the dump fileMy current workaround is:
We could make this workaround obsolete with the
pg_restore
flag---create
[2].Wdyt?
[1] https://github.com/makandra/geordi/blob/cab2391c712a15107b3e26573c1676699b9e2a25/lib/geordi/dump_loader.rb#L63-L71 [2] https://www.postgresql.org/docs/current/app-pgdump.html