aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2015-01-11 12:28:55 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2015-01-11 12:28:55 +0100
commit17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52 (patch)
tree20c2c99e710fd1db438a49029177552204a63591 /app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql
parent4a2ca2d94c827566f8682e8dbd6fbdf17d70b4dd (diff)
downloadio.trygvis.soilmoisture-android-17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52.tar.gz
io.trygvis.soilmoisture-android-17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52.tar.bz2
io.trygvis.soilmoisture-android-17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52.tar.xz
io.trygvis.soilmoisture-android-17a1f7227c8c3872fce7bbcc2f5cd46540f9ac52.zip
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.
Diffstat (limited to 'app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql')
-rw-r--r--app/src/main/assets/db/migration/sm/V001.003__new_baseline.sql22
1 files changed, 22 insertions, 0 deletions
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
+);