Skip to content

Commit

Permalink
Chore: move sql comments to be within function bodies, so they can be…
Browse files Browse the repository at this point in the history
… inspected later
  • Loading branch information
mindreframer committed Sep 4, 2024
1 parent f6bc054 commit 8c05558
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/migrations/migration002.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ defmodule Migrations.Migration002 do
CREATE OR REPLACE FUNCTION essig_add_xid_snapmin()
RETURNS TRIGGER AS $$
BEGIN
-- we add current transaction id and minimal LSN
-- based on suggestions here: https://github.com/josevalim/sync/blob/main/priv/repo/migrations/20240806131210_create_publication.exs
NEW._xid := pg_current_xact_id();
NEW._snapmin := pg_snapshot_xmin(pg_current_snapshot());
RETURN NEW;
Expand Down
4 changes: 3 additions & 1 deletion lib/migrations/migration003.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ defmodule Migrations.Migration003 do
"DROP TRIGGER essig_add_xid_to_signals;"

execute "
-- Function to notify on new transactions (events) via pg_notify
CREATE OR REPLACE FUNCTION notify_new_events()
RETURNS TRIGGER AS $$
DECLARE
payload JSON;
BEGIN
-- Function to notify on new transactions (events) via pg_notify
payload := json_build_object(
'scope_uuid', NEW.scope_uuid,
'_xid', NEW._xid,
Expand Down

0 comments on commit 8c05558

Please sign in to comment.