Supabase history inserts

When authenticated home page loads persist probe rows with timestamps, labels, and humidity.

Historical charts depend on periodic inserts into Supabase Postgres—not on the browser remembering prior values. A scheduled job or edge function polls feeds and writes normalized rows keyed by user and probe.

Insert model

  • Timestamp + user_id + probe_key uniquely identify a sample.
  • Store temp, humidity, units as typed columns for fast chart queries.
  • Skip insert if upstream fetch failed to avoid flatlines at zero.

Auth boundary

Row-level security ties history to signed-in users—Supabase auth flow. Only the service role or trusted server route should insert on schedule.

Consumption

Dashboard reads via history browsing; export via CSV export. Live path: home page fetch.