0046_usage_events_pushed_value.sql 570 B

12345678
  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.
  8. ALTER TABLE "usage_events" ADD COLUMN IF NOT EXISTS "pushed_value" text;