Bugfix: Correct SQlite db intialisation code

This commit is contained in:
Starbeamrainbowlabs 2019-07-10 14:20:46 +01:00
parent 08a4ebe9f1
commit 70d29a9517
1 changed files with 4 additions and 4 deletions

View File

@ -1,13 +1,13 @@
-- See for data provided by TTN https://www.thethingsnetwork.org/docs/applications/mqtt/api.html
CREATE TABLE readings IF NOT EXISTS (
CREATE TABLE IF NOT EXISTS readings (
id INTEGER PRIMARY KEY, -- Random unique integer
lat FLOAT NOT NULL, -- Latitude component of GPS co-ordinates of reading
long FLOAT NOT NULL, -- Longitude component of GPS co-ordinates of reading,
data_rate TEXT NOT NULL, -- The id of the data rate code in the data_rates table that describes the data rate at which the message was transmitted
code_rate TEXT, -- The coding rate at which the message was transmitted. FUTURE: This may need to be an INTEGER field - not sure
code_rate TEXT -- The coding rate at which the message was transmitted. FUTURE: This may need to be an INTEGER field - not sure
-- bit_rate INTEGER, -- The bit rate at which the message was transmitted -- We didn't actually recieve this - disparity between API docs & actual message
);
CREATE TABLE rssis IF NOT EXISTS (
CREATE TABLE IF NOT EXISTS rssis (
id INTEGER PRIMARY KEY, -- Random unique int
reading_id INTEGER, -- The id of the object in the readings table that this rssi measurement belongs to
gateway_id TEXT, -- Gateway id that the RSSI was from
@ -15,7 +15,7 @@ CREATE TABLE rssis IF NOT EXISTS (
snr FLOAT, -- The signal-to-noise ratio
channel INTEGER -- The channel that the RSSI was received over. We might be able to use this to detect single-channel gateways
);
CREATE TABLE gateways IF NOT EXISTS (
CREATE TABLE IF NOT EXISTS gateways (
id TEXT PRIMARY KEY, -- The gateway's name
lat FLOAT, -- Latitude component of the claimed GPS co-ordinates of the gateway
long FLOAT, -- Longitude component of the claimed GPS co-ordinates of the gateway