Skip to content

Commit

Permalink
Merge pull request #12130 from mvdbeek/legacy_postgres_testing
Browse files Browse the repository at this point in the history
[21.05] Fix history audit table tow trigger
  • Loading branch information
jmchilton committed Jun 11, 2021
2 parents 03d31a5 + 5e1cf71 commit e64dab3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/api_paste.yaml
Expand Up @@ -12,7 +12,8 @@ jobs:
python-version: ['3.7']
services:
postgres:
image: postgres:13
# Run tests on the oldest Galaxy-supported version
image: postgres:9.6
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy/model/migrate/triggers/update_audit_table.py
Expand Up @@ -107,7 +107,9 @@ def row_trigger_def(source_table, id_field, operation, when="AFTER", function_ke
return f"""
CREATE TRIGGER {trigger_name}
{when} {operation} ON {source_table}
FOR EACH ROW EXECUTE {function_keyword} {fn}();
FOR EACH ROW
WHEN (NEW.{id_field} IS NOT NULL)
EXECUTE {function_keyword} {fn}();
"""

# pick row or statement triggers depending on postgres version
Expand Down

0 comments on commit e64dab3

Please sign in to comment.