diff --git a/etc/db/upgrades/upgrade12-v0.2.2-new-event-log-schema.sql b/etc/db/upgrades/upgrade12-v0.2.2-new-event-log-schema.sql index 6acec68..81271b7 100644 --- a/etc/db/upgrades/upgrade12-v0.2.2-new-event-log-schema.sql +++ b/etc/db/upgrades/upgrade12-v0.2.2-new-event-log-schema.sql @@ -158,7 +158,11 @@ BEGIN -- Complete the tstamp if possible IF NEW.sequence IS NOT NULL AND NEW.point IS NOT NULL AND NEW.tstamp IS NULL THEN - SELECT ts INTO NEW.tstamp FROM tstamp_from_sequence_shot(NEW.sequence, NEW.point); + SELECT COALESCE( + tstamp_from_sequence_shot(NEW.sequence, NEW.point), + tstamp_interpolate(NEW.sequence, NEW.point) + ) + INTO NEW.tstamp; END IF; -- Any id that is provided will be ignored. The generated @@ -187,7 +191,11 @@ BEGIN IF NEW.sequence <> OLD.sequence OR NEW.point <> OLD.point AND NEW.sequence IS NOT NULL AND NEW.point IS NOT NULL AND NEW.tstamp IS NULL OR NEW.tstamp = OLD.tstamp THEN - SELECT ts INTO NEW.tstamp FROM tstamp_from_sequence_shot(NEW.sequence, NEW.point); + SELECT COALESCE( + tstamp_from_sequence_shot(NEW.sequence, NEW.point), + tstamp_interpolate(NEW.sequence, NEW.point) + ) + INTO NEW.tstamp; END IF; UPDATE event_log_full