nsg / immich-distribution

Experimental Immich distribution inside a snap
MIT License
19 stars 0 forks source link

Immich 1.63 released #40

Closed nsg closed 1 year ago

nsg commented 1 year ago

Message

This release adds this constraint to the database:

ALTER TABLE "assets" ADD CONSTRAINT "UQ_4ed4f8052685ff5b1e7ca1058ba" UNIQUE ("originalPath")

It appears that this column is non-unique on a few installations, I guess this could be true for Immich Distribution installations as well. The official fix suggest that you lists conflicts in the database, delete these assets from the database and re-import the files.

Stages

nsg commented 1 year ago

I need to handle the potential breaking change in the database, I have considered the following things:

  1. Immich Distribution has still few users.
  2. The likelihood that a user has this problem is low.
  3. Immich current experimental nature makes breaking changes with manual steps okay.
  4. This package is automatically updated for most users, I rather not automatically breaks an installation at a bad time.
  5. I can't fix this automatically in the background without data loss (lost tags, asset removed from album, ...), or at least not without an considerable amount of work. Considering the first and second points, and the likelihood that this occurs I rather not build this.

With that in mind I'm pushing a pre-refresh hook that checks the database for duplicate asset paths. If they exists the refresh will be aborted leaving the user at a older (but working) version until he or she has manually fixed the state.

If you run snap refresh interactively you will see:

error: cannot perform the following tasks:
- Run pre-refresh hook of "immich-distribution" snap if present (run hook "pre-refresh": 
-----
There are duplicate assets originalPath in the database.
You need to manually fix this, the update is blocked until this is fixed.
For more information see: https://github.com/immich-app/immich/issues/2931#issuecomment-1605396092
Run 'sudo immich-distribution.psql -d immich' to query the database.
The affected assets are:
                         originalPath                         | count 
--------------------------------------------------------------+-------
 upload/library/admin/2020/2020-05-01/IMG_20200501_151923.jpg |     2
(1 row)
-----)
nsg commented 1 year ago

Two installs are still at v1.60, these systems has apparently automatic updates turned off. There is no way for me to know when they updates so I will move forward and release this to stable now.