Migrating from docker → proxmox LXC, restore failing - better way?

I recently moved my homelab into proxmox, which now has zfs via truenas, and my immich service moved from a separate device into an immich LXC (here). I started with process in Immich v1.135.3, and both systems are currently locked at that version.

I have a full DB backup as described in the backup/restore docs.

The proxmox/immich setup has a different user/role setup, so I
  • chopped the first ~40 lines where users/roles are dumped,
  • updated all 'OWNER TO' immich except for the postgres and template1 DBs (matching proxmox virgin setup),
  • and attempted to restore with a command like this:
cat ./immich-restore.sql | sed "s/SELECT pg_catalog.set_config('search_path', '', false);/SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);/g" | ./psql-immich

I get a fair number of errors, of the sorts:
ERROR:  duplicate key value violates unique constraint "PK_5c8a79801b44bd27b79228e1dad"
DETAIL:  Key (id)=(3d016055-7581-4246-9c7b-c2b62c6c6123) already exists.
CONTEXT:  COPY api_keys, line 1
ERROR:  insert or update on table "asset_faces" violates foreign key constraint "FK_02a43fd0b3c50fb6d7f0cb7282c"
DETAIL:  Key (assetId)=(17498d46-e0e6-4969-a642-ef09dee16a72) is not present in table "assets".
...
ERROR:  relation "IDX_partners_audit_deleted_at" already exists
...
ERROR:  trigger "asset_exif_updated_at" for relation "exif" already exists
...
ERROR:  constraint "FK_0f6fc2fb195f24d19b0fb0d57c1" for relation "libraries" already exists
...


2 questions

Is this my best route? I'd be happy to use another method (e.g. immich-go) so long as I can maintain my albums and existing dedupe efforts

If so, am I missing the boat on postgres restore? Given a backup from a functioning immich, I wouldn't expect these kinds of errors...
Was this page helpful?