I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.
The bug
I am running Immich v3.2.2 from the TrueNAS Apps catalog and have been updating it through the TrueNAS catalog.
This schema drift warning has existed for several Immich updates, not only the latest one:
Migrations are up to date
Detected schema drift.
- FunctionCreate: The function "person_delete_audit" is missing and needs to be created
immich-admin schema-check generates:
CREATE OR REPLACE FUNCTION person_delete_audit()
RETURNS TRIGGER
LANGUAGE PLPGSQL
AS $$
BEGIN
INSERT INTO person_audit ("personGroupId", "ownerId")
SELECT "personGroupId", "ownerId"
FROM OLD;
RETURN NULL;
END
$$;
I executed that exact SQL against the Immich PostgreSQL database and received:
CREATE FUNCTION
However, immich-admin schema-check still reports the function as missing, including after restarting Immich.
I verified that the function actually exists:
schema | function | arguments
--------+---------------------+-----------
public | person_delete_audit |
The function definition is:
CREATE OR REPLACE FUNCTION public.person_delete_audit()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
INSERT INTO person_audit ("personGroupId", "ownerId")
SELECT "personGroupId", "ownerId"
FROM OLD;
RETURN NULL;
END
$function$
The trigger also exists and references the function:
person_delete_audit | CREATE TRIGGER person_delete_audit
AFTER DELETE ON public.person
REFERENCING OLD TABLE AS old
FOR EACH STATEMENT
WHEN ((pg_trigger_depth() <= 1))
EXECUTE FUNCTION person_delete_audit()
Both related migration override entries are present:
function_person_delete_audit
trigger_person_delete_audit
Immich is connected to the same database:
DB_PORT=5432
DB_DATABASE_NAME=immich
DB_HOSTNAME=pgvecto
DB_USERNAME=immich
So PostgreSQL appears to have the expected function and trigger, but schema-check continues to report FunctionCreate: person_delete_audit is missing.
Is this a schema-check detection issue, or is there another database object/metadata entry that should be checked?
The OS that Immich Server is running on
Truenas 25.10.7 - Goldeye
Version of Immich Server
v3.2.2
Version of Immich Mobile App
v3.2.1
Platform with the issue
Device make and model
No response
Your docker-compose.yml content
immich from truenas cataloug
Your .env content
immich from truenas cataloug
Reproduction steps
1.after upgrading im not sure from which version to which version the error was there for a while
2.
3.
...
Relevant log output
### Relevant logs
Immich startup:
[Microservices:DatabaseRepository] Running migrations
[Microservices:DatabaseRepository] Finished running migrations
[Microservices:DatabaseService] Checking for schema drift
[Microservices:DatabaseService] Detected schema drift.
- The function "person_delete_audit" is missing and needs to be created
The API worker reports the same thing:
[Api:DatabaseRepository] Running migrations
[Api:DatabaseRepository] Finished running migrations
[Api:DatabaseService] Checking for schema drift
[Api:DatabaseService] Detected schema drift.
- The function "person_delete_audit" is missing and needs to be created
`immich-admin schema-check`:
Migrations are up to date
Detected schema drift.
- FunctionCreate: The function "person_delete_audit" is missing and needs to be created
After creating the function successfully with the SQL generated by `schema-check`:
CREATE FUNCTION
Running `immich-admin schema-check` again still returns the same:
Migrations are up to date
Detected schema drift.
- FunctionCreate: The function "person_delete_audit" is missing and needs to be created
Additional information
No response
I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.
The bug
I am running Immich v3.2.2 from the TrueNAS Apps catalog and have been updating it through the TrueNAS catalog.
This schema drift warning has existed for several Immich updates, not only the latest one:
immich-admin schema-check generates:
I executed that exact SQL against the Immich PostgreSQL database and received:
CREATE FUNCTIONHowever, immich-admin schema-check still reports the function as missing, including after restarting Immich.
I verified that the function actually exists:
The function definition is:
The trigger also exists and references the function:
Both related migration override entries are present:
Immich is connected to the same database:
So PostgreSQL appears to have the expected function and trigger, but schema-check continues to report FunctionCreate: person_delete_audit is missing.
Is this a schema-check detection issue, or is there another database object/metadata entry that should be checked?
The OS that Immich Server is running on
Truenas 25.10.7 - Goldeye
Version of Immich Server
v3.2.2
Version of Immich Mobile App
v3.2.1
Platform with the issue
Device make and model
No response
Your docker-compose.yml content
immich from truenas catalougYour .env content
Reproduction steps
1.after upgrading im not sure from which version to which version the error was there for a while
2.
3.
...
Relevant log output
Additional information
No response