app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

0002_activity_journal.sql (993B)


      1 CREATE TABLE activity_events (
      2     activity_event_id TEXT PRIMARY KEY,
      3     recorded_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
      4     event_kind TEXT NOT NULL,
      5     settings_section TEXT,
      6     settings_preference TEXT,
      7     preference_enabled INTEGER,
      8     CHECK (
      9         event_kind IN (
     10             'home_opened',
     11             'settings_opened',
     12             'settings_section_selected',
     13             'settings_preference_updated'
     14         )
     15     ),
     16     CHECK (
     17         settings_section IS NULL
     18         OR settings_section IN ('account', 'settings', 'about')
     19     ),
     20     CHECK (
     21         settings_preference IS NULL
     22         OR settings_preference IN (
     23             'allow_relay_connections',
     24             'use_media_servers',
     25             'use_nip05',
     26             'launch_at_login'
     27         )
     28     ),
     29     CHECK (preference_enabled IS NULL OR preference_enabled IN (0, 1))
     30 );
     31 
     32 CREATE INDEX activity_events_recorded_at_idx
     33     ON activity_events(recorded_at DESC, activity_event_id DESC);