Skip to content

Commit

Permalink
Make trigger not need an parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
LostKobrakai committed Sep 4, 2020
1 parent 66cfbc3 commit 6d8dfb1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/fable/migrations.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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 $$
Expand All @@ -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(
Expand Down Expand Up @@ -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}"
)
Expand Down

0 comments on commit 6d8dfb1

Please sign in to comment.