diff options
author | pks <pks@pks.rocks> | 2021-05-01 06:17:55 +0200 |
---|---|---|
committer | pks <pks@pks.rocks> | 2021-05-01 06:17:55 +0200 |
commit | f461190e22a97bde985b067ce01c4ed9c74f7e62 (patch) | |
tree | 0c2c48d1933765f83d083241df2dd74c6603f2bc /v1/create-db.rb | |
parent | 63fbf0f3aadb4b6d037a8164b501fe836d9c361d (diff) |
v1
Diffstat (limited to 'v1/create-db.rb')
-rwxr-xr-x | v1/create-db.rb | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/v1/create-db.rb b/v1/create-db.rb new file mode 100755 index 0000000..2866b7b --- /dev/null +++ b/v1/create-db.rb @@ -0,0 +1,51 @@ +#!/usr/bin/env ruby + +require 'sqlite3' + +db = SQLite3::Database.new("weather.db") + +db.execute <<-SQL + create table rain( + id INTEGER PRIMARY KEY, + timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, + device_type TEXT, + device_id TEXT, + battery INTEGER, + rssi INTEGER, + rain_rate FLOAT, + rain_total FLOAT + ); + SQL +db.execute <<-SQL + create table wind( + id INTEGER PRIMARY KEY, + timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, + device_type TEXT, + device_id TEXT, + battery INTEGER, + rssi INTEGER, + chill FLOAT, + temperature FLOAT, + average_speed FLOAT, + direction INTEGER, + gust FLOAT + ); + SQL +db.execute <<-SQL + create table temp( + id INTEGER PRIMARY KEY, + timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, + device_type TEXT, + device_id TEXT, + battery INTEGER, + rssi INTEGER, + humidity FLOAT, + humidity_status TEXT, + humidity_status_numeric INTEGER, + temperature FLOAT, + forecast TEXT, + forecast_numeric INTEGER + ); + SQL + +db.close |