From 1d9ace033726cad4a32870308151cfc75fd4e727 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 4 Jul 2026 14:12:14 +0000 Subject: [PATCH] Immich: address Copilot PR review findings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix check_vchord_extension (and check_vector_extension) to query pg_available_extensions against the actual immich database instead of pg_extension on the default connection database. Immich creates the vchord extension itself on first startup, so checking pg_extension before Immich ever runs produced a false warning on every fresh install; checking pg_available_extensions reports whether the server CAN provide the extension, which is what the startup diagnostic actually needs. - Drop the vestigial `services: - mysql:want` Supervisor service-discovery hint from the four Immich config.yaml files: nothing in the add-on reads it, and the scripts are hard-coded to PostgreSQL via psql — Immich has never supported MySQL. Also fix the matching misleading line in the base README. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01PcbbgB7A5LLbPuPRjLUouk --- immich/README.md | 2 +- immich/config.yaml | 2 -- immich/rootfs/etc/cont-init.d/99-run.sh | 27 ++++++++++++++----------- immich_cuda/config.yaml | 2 -- immich_noml/config.yaml | 2 -- immich_openvino/config.yaml | 2 -- 6 files changed, 16 insertions(+), 21 deletions(-) diff --git a/immich/README.md b/immich/README.md index daa138ed37..77a5ea6e9e 100644 --- a/immich/README.md +++ b/immich/README.md @@ -46,7 +46,7 @@ See the official [v3 migration guide](https://immich.app/blog/v3-migration) for ## Configuration -Webui can be found at `:8080`. PostgreSQL/MySQL can be either internal or external. +Webui can be found at `:8080`. PostgreSQL can be either internal or external. ### Options diff --git a/immich/config.yaml b/immich/config.yaml index dee2b40f44..9b67d47067 100644 --- a/immich/config.yaml +++ b/immich/config.yaml @@ -137,8 +137,6 @@ schema: localdisks: str? networkdisks: str? skip_permissions_check: bool? -services: - - mysql:want slug: immich udev: true url: https://github.com/alexbelgium/hassio-addons diff --git a/immich/rootfs/etc/cont-init.d/99-run.sh b/immich/rootfs/etc/cont-init.d/99-run.sh index 0e83d23f23..50e8b0c6cf 100755 --- a/immich/rootfs/etc/cont-init.d/99-run.sh +++ b/immich/rootfs/etc/cont-init.d/99-run.sh @@ -144,28 +144,31 @@ EOF bashio::log.info "Database setup completed successfully." } -# Function to check if vectors extension is enabled +# Function to check if the vectors (pgvecto.rs) extension is available on the server check_vector_extension() { - echo "Checking if 'vectors' extension is enabled..." - RESULT=$(psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT" -tAc "SELECT extname FROM pg_extension WHERE extname = 'vectors';") - if [[ "$RESULT" == "vectors" ]]; then - echo "✅ 'vectors' extension is enabled." + echo "Checking if 'vectors' extension is available for database '${DB_DATABASE_NAME}'..." + RESULT=$(psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT/${DB_DATABASE_NAME}" -tAc "SELECT 1 FROM pg_available_extensions WHERE name = 'vectors';") + if [[ "$RESULT" == "1" ]]; then + echo "✅ 'vectors' extension is available." return 0 else - bashio::log.warning "❌ 'vectors' extension is NOT enabled." + bashio::log.warning "❌ 'vectors' extension is NOT available." return 1 fi } -# Function to check if vchord extension is enabled +# Function to check if the VectorChord (vchord) extension is available on the server. +# Uses pg_available_extensions (whether the extension CAN be created) rather than +# pg_extension (whether it has already been created), since Immich creates the extension +# itself on first startup; checking pg_extension would false-warn on every fresh install. check_vchord_extension() { - echo "Checking if 'vchord' extension is enabled..." - RESULT=$(psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT" -tAc "SELECT extname FROM pg_extension WHERE extname = 'vchord';") - if [[ "$RESULT" == "vchord" ]]; then - echo "✅ 'vchord' extension is enabled." + echo "Checking if 'vchord' extension is available for database '${DB_DATABASE_NAME}'..." + RESULT=$(psql "postgres://$DB_USERNAME:$DB_PASSWORD@$DB_HOSTNAME:$DB_PORT/${DB_DATABASE_NAME}" -tAc "SELECT 1 FROM pg_available_extensions WHERE name = 'vchord';") + if [[ "$RESULT" == "1" ]]; then + echo "✅ 'vchord' extension is available." return 0 else - bashio::log.warning "❌ 'vchord' extension is NOT enabled." + bashio::log.warning "❌ 'vchord' extension is NOT available." return 1 fi } diff --git a/immich_cuda/config.yaml b/immich_cuda/config.yaml index 2c6f01d909..77a2e51a6e 100644 --- a/immich_cuda/config.yaml +++ b/immich_cuda/config.yaml @@ -135,8 +135,6 @@ schema: localdisks: str? networkdisks: str? skip_permissions_check: bool? -services: - - mysql:want slug: immich_cuda udev: true url: https://github.com/alexbelgium/hassio-addons diff --git a/immich_noml/config.yaml b/immich_noml/config.yaml index 400a766923..8b8303346c 100644 --- a/immich_noml/config.yaml +++ b/immich_noml/config.yaml @@ -136,8 +136,6 @@ schema: localdisks: str? networkdisks: str? skip_permissions_check: bool? -services: - - mysql:want slug: immich_noml udev: true url: https://github.com/alexbelgium/hassio-addons diff --git a/immich_openvino/config.yaml b/immich_openvino/config.yaml index e60d7b7971..57acf0bc82 100644 --- a/immich_openvino/config.yaml +++ b/immich_openvino/config.yaml @@ -136,8 +136,6 @@ schema: localdisks: str? networkdisks: str? skip_permissions_check: bool? -services: - - mysql:want slug: immich_openvino udev: true url: https://github.com/alexbelgium/hassio-addons