Skip to content

Commit

Permalink
now only commit changes in changetable if the old and new has changed (
Browse files Browse the repository at this point in the history
  • Loading branch information
runeanielsen authored Mar 25, 2023
1 parent 060999c commit 8608dfe
Showing 1 changed file with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ BEGIN
RETURN null;
END IF;

insert into route_network.route_network_edit_operation (event_id, before, after, type)
values (
uuid_generate_v4(),
to_json(OLD),
to_json(NEW),
'RouteNode'
);
IF to_json(OLD) <> to_json(NEW)
THEN
insert into route_network.route_network_edit_operation (event_id, before, after, type)
values (
uuid_generate_v4(),
to_json(OLD),
to_json(NEW),
'RouteNode'
);
END IF;

RETURN NEW;
END $function$
Expand Down Expand Up @@ -87,13 +90,16 @@ BEGIN
RETURN null;
END IF;

insert into route_network.route_network_edit_operation (event_id, before, after, type)
values (
uuid_generate_v4(),
to_json(OLD),
to_json(NEW),
'RouteSegment'
);
IF to_json(OLD) <> to_json(NEW)
THEN
insert into route_network.route_network_edit_operation (event_id, before, after, type)
values (
uuid_generate_v4(),
to_json(OLD),
to_json(NEW),
'RouteSegment'
);
END IF;

RETURN NEW;
END $function$
Expand Down

0 comments on commit 8608dfe

Please sign in to comment.