pulsejet / memories

Fast, modern and advanced photo management suite. Runs as a Nextcloud app.
https://memories.gallery
GNU Affero General Public License v3.0
2.86k stars 77 forks source link

ERROR creating TRIGGER PostgreSQL version < 14 #1179

Closed manuelfloresv closed 3 weeks ago

manuelfloresv commented 3 weeks ago

When executing Trigger compatibility mode, running occ maintenance repair gives error when creating the trigger

occ  maintenance:repair
     - WARNING: Failed to create filecache trigger (compatibility mode will be used): An exception occurred while executing a query: SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near "TRIGGER"
LINE 1: CREATE OR REPLACE TRIGGER memories_fcu_trg

Postgresql Logs

 nextcloud@nextcloud ERROR:  syntax error at or near "TRIGGER" at character 19
 nextcloud@nextcloud STATEMENT:  CREATE OR REPLACE TRIGGER memories_fcu_trg
                        AFTER UPDATE ON oc_filecache
                        FOR EACH ROW
                        EXECUTE FUNCTION memories_fcu_fun();

This line does not account for older version of postgresql that does not support the syntax CREATE OR REPLACE TRIGGER but only CREATE TRIGGER: https://github.com/pulsejet/memories/blob/01eb88939978cdcb0a7f74138005421b7afa18e4/lib/Db/AddMissingIndices.php#L121

https://memories.gallery/troubleshooting/#trigger-compatibility-mode

Software Versions

pulsejet commented 3 weeks ago

Yep https://github.com/pulsejet/memories/issues/1106