From be69b1444d0f0e1b2ce1b1b6af65c43fed67eb1b Mon Sep 17 00:00:00 2001 From: Garry Hill Date: Thu, 9 Nov 2023 09:58:30 +0000 Subject: [PATCH] map compensation message to replication update --- .../lib/electric/replication/postgres/slot_server.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/electric/lib/electric/replication/postgres/slot_server.ex b/components/electric/lib/electric/replication/postgres/slot_server.ex index 1db142b3ba..4fe17d9c7e 100644 --- a/components/electric/lib/electric/replication/postgres/slot_server.ex +++ b/components/electric/lib/electric/replication/postgres/slot_server.ex @@ -458,6 +458,13 @@ defmodule Electric.Replication.Postgres.SlotServer do } end + defp changes_to_wal(%Changes.Compensation{relation: table, record: new}, relations) do + %ReplicationMessages.Update{ + relation_id: relations[table].oid, + tuple_data: record_to_tuple(new, relations[table].columns) + } + end + defp changes_to_wal( %Changes.UpdatedRecord{relation: table, old_record: nil, record: new}, relations