Get you a Pi, quantify your vermin.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
749 B

  1. -- This creates a table with structure like:
  2. -- id | timestamp | event_type
  3. CREATE TABLE events(id INTEGER PRIMARY KEY, timestamp TEXT, event_type INTEGER);
  4. -- Event type will reference the id of a row in event_types - this lets us
  5. -- extend the table later on to include more sensors.
  6. CREATE TABLE event_types(id INTEGER PRIMARY KEY, name TEXT);
  7. INSERT INTO event_types (id, name) VALUES (1, 'motion');
  8. INSERT INTO event_types (id, name) VALUES (2, 'trap');
  9. -- You'd log a motion event, like the mouse nosing around the entrance
  10. -- to the trap, with:
  11. -- INSERT INTO events(timestamp, event_type) VALUES (DATETIME(), 1);
  12. -- And a trap-tipping event a few seconds later with:
  13. -- INSERT INTO events(timestamp, event_type) VALUES (DATETIME(), 2);