From 17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 11 Jan 2015 12:28:55 +0100 Subject: o Reading values from the soil sensor. o Rewrote the database schema to match the new device+sensors model. o Storing samples in the database. o To be able to reuse BT callbacks, added a way to always to directly to the next step instead of waiting for an event. --- .../db/migration/sm/V001.003__new_baseline.sql | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql (limited to 'app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql') diff --git a/app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql b/app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql new file mode 100644 index 0000000..c120b08 --- /dev/null +++ b/app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql @@ -0,0 +1,22 @@ +drop table soil_sample; +drop table soil_monitor; + +create table sm_device( + id integer not null primary key autoincrement, + bt_device integer not null references bt_device(id), + useful boolean +); + +create table sm_sensor( + id integer not null primary key autoincrement, + sm_device integer not null references soil_device(id), + idx integer not null, + constraint uq_sensor_idx unique(sm_device, idx) +); + +create table soil_sample( + id integer not null primary key autoincrement, + sm_sensor integer not null references sm_sensor(id), + timestamp timestamp, + value integer +); -- cgit v1.2.3