CPM History

CPM History Schema

Database

  • File: weather_cache.db
  • Engine: expo-sqlite

Table: cpm_history

ColumnTypeNullNotes
cpmREALNOT NULLOne computed CPM value per successful minute tick.
timestampINTEGERNOT NULLEpoch milliseconds when the value was recorded.

Data Invariants

  • Each row stores only cpm and timestamp.
  • Values must be finite numbers (insertCpmRow validates inputs).
  • Retention is capped at 40 rows; oldest rows are removed first on insert overflow.

Access Patterns

  • Insert and bounded retention: insertCpmRow(cpm, timestamp?).
  • Recent read window: getRecentCpmRows(sinceTimestamp, limit).
  • Read ordering: newest first (ORDER BY timestamp DESC, rowid DESC).