uselagoon / lagoon-sync

Apache License 2.0
6 stars 5 forks source link

`pg_restore` shouldn't restore object ownership #100

Closed rocketeerbkw closed 11 months ago

rocketeerbkw commented 11 months ago

Object owner ship will vary between local and various remote environments. By default pg_restore will attempt to set the owner to roles which don't exist and throw an error. These errors are ignored and the restore seems to complete but it will output a non-zero exit code and cause lagoon-sync to not clean up:

pg_restore: error: could not execute query: ERROR:  role "drupal" does not exist
Command was: ALTER SCHEMA public OWNER TO drupal;

pg_restore: error: could not execute query: ERROR:  role "drupal" does not exist
Command was: ALTER TABLE public.foo OWNER TO drupal;

pg_restore: error: could not execute query: ERROR:  role "drupal" does not exist
Command was: ALTER TABLE public.foo_id_seq OWNER TO drupal;

pg_restore: warning: errors ignored on restore: 3