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

skip created_at and updated_at fields #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/pg_audit_log/function.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def user_unique_name_temporary_function(username)

def install
execute <<-SQL
CREATE OR REPLACE PROCEDURAL LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION #{name}() RETURNS trigger
LANGUAGE plpgsql
AS $_$
Expand Down Expand Up @@ -81,6 +80,8 @@ def install
column_name := col.column_name;
IF TG_RELNAME = '#{users_table_name}' AND column_name = '#{users_access_column}' THEN
NULL;
ELSIF column_name = 'created_at' OR column_name = 'updated_at' THEN
NULL;
ELSE
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
EXECUTE 'SELECT CAST($1 . '|| column_name ||' AS TEXT)' INTO new_value USING NEW;
Expand Down