Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[21.05] Fix history audit table row trigger #12130

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/api_paste.yaml
Expand Up @@ -12,7 +12,7 @@ jobs:
python-version: ['3.7']
services:
postgres:
image: postgres:13
image: postgres:9.6
mvdbeek marked this conversation as resolved.
Show resolved Hide resolved
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