From 6d8dfb170b7a8d10738cdb5d3011abb9f1891c4a Mon Sep 17 00:00:00 2001 From: Benjamin Milde Date: Fri, 4 Sep 2020 16:51:06 +0200 Subject: [PATCH] Make trigger not need an parameter --- lib/fable/migrations.ex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fable/migrations.ex b/lib/fable/migrations.ex index 6526498..0fe6d70 100644 --- a/lib/fable/migrations.ex +++ b/lib/fable/migrations.ex @@ -18,7 +18,7 @@ defmodule Fable.Migrations do execute( """ - create or replace function fn_trigger_last_event_update(_tbl regclass) returns trigger + create or replace function fn_trigger_last_event_update() returns trigger security definer language plpgsql as $$ @@ -31,7 +31,7 @@ defmodule Fable.Migrations do event_json text := json_build_object( 'aggregate_id', NEW.aggregate_id, 'aggregate_table', NEW.aggregate_table, - 'events_table', _tbl, + 'events_table', TG_TABLE_NAME, 'id', NEW.id ); update_aggregate text := format( @@ -66,7 +66,7 @@ defmodule Fable.Migrations do """ create trigger event_insert_update_last_event_id after insert on #{table} for each row - execute procedure fn_trigger_last_event_update(#{table}) + execute procedure fn_trigger_last_event_update() """, "drop trigger event_insert_update_last_event_id ON #{table}" )