AK
Size: a a a
AK
n
КБ
n
n
n
n
n
n
n
-- Trigger function that inserts the table name and the row id into sync_update_log table
CREATE OR REPLACE FUNCTION sync_update_log_<%= entity %>()
RETURNS trigger AS $$
BEGIN
INSERT INTO sync_update_log (entity, entity_id, updated_at) VALUES (entity, NEW.id, now());
RETURN NEW;
END; $$
LANGUAGE PLPGSQL;
-- Trigger that calls the trigger function after update
CREATE TRIGGER trigger_sync_update_log_<%= entity %>
AFTER UPDATE
ON <%= entity %>
FOR EACH ROW
EXECUTE PROCEDURE sync_update_log_<%= entity %>();
-- Trigger that calls the trigger function after insert
CREATE TRIGGER trigger_sync_update_log_<%= entity %>
AFTER INSERT
ON <%= entity %>
FOR EACH ROW
EXECUTE PROCEDURE sync_update_log_<%= entity %>();
AK
КБ
КБ
sync_update_log. There’s no need to migrate same entity mutiple times. I’m not sure if postgres has ON DUPLICATE KEY UPDATE, I mostly work with MySQL. Maybe INSERT IGNORE?…n
sync_update_log. There’s no need to migrate same entity mutiple times. I’m not sure if postgres has ON DUPLICATE KEY UPDATE, I mostly work with MySQL. Maybe INSERT IGNORE?…n
n
n
АЕ
IK
АЕ