0046_usage_events_pushed_value.sql8 lines · main
1-- usage_events.pushed_value — the running total already delivered to Polar
2-- for a GAUGE row (storage_bytes, auth_mau). The Polar meter push sends
3-- `value - pushed_value` (delta-to-latest) and advances pushed_value on a
4-- 2xx, so a SUM-type meter bills the latest gauge value exactly once and can
5-- never over-count the ~720 hourly snapshots a billing month produces.
6-- NULL for counter rows (invocations, connection_seconds), which keep
7-- pushing their absolute hourly value unchanged.
8ALTER TABLE "usage_events" ADD COLUMN IF NOT EXISTS "pushed_value" text;