From be44087bf603e595c684d83c727e6441c7b7f39a Mon Sep 17 00:00:00 2001 From: Roman Bazalevsky Date: Fri, 16 Nov 2018 13:55:40 +0300 Subject: [PATCH 1/1] =?utf8?q?=D0=92=D1=81=D0=B5=D0=B3=D0=B4=D0=B0=20?= =?utf8?q?=D0=BF=D1=8B=D1=82=D0=B0=D0=B5=D0=BC=D1=81=D1=8F=20=D1=81=D0=BE?= =?utf8?q?=D0=B7=D0=B4=D0=B0=D1=82=D1=8C=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8?= =?utf8?q?=D1=86=D1=8B=20=D0=BF=D1=80=D0=B8=20=D1=81=D1=82=D0=B0=D1=80?= =?utf8?q?=D1=82=D0=B5=20-=20=D0=BF=D0=BE=D0=BC=D0=BE=D0=B6=D0=B5=D1=82=20?= =?utf8?q?=D0=BE=D1=82=20=D0=BF=D1=83=D1=81=D1=82=D0=BE=D0=B3=D0=BE=20?= =?utf8?q?=D1=84=D0=B0=D0=B9=D0=BB=D0=B0=20=D0=B2=20=D0=B1=D1=8D=D0=BA?= =?utf8?q?=D0=B0=D0=BF=D0=B5=20=D0=B8=20=D1=82=D0=BE=D0=BC=D1=83=20=D0=BF?= =?utf8?q?=D0=BE=D0=B4=D0=BE=D0=B1=D0=BD=D1=8B=D1=85=20=D1=81=D0=B8=D1=82?= =?utf8?q?=D1=83=D0=B0=D1=86=D0=B8=D0=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/weathermon | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/bin/weathermon b/bin/weathermon index b8be15f..fb431a7 100755 --- a/bin/weathermon +++ b/bin/weathermon @@ -348,22 +348,18 @@ end if backlogdb then if not file_exists(backlogdb) then touch(backlogdb) - backlog_con = assert(env:connect(backlogdb)) - backlog_con:execute("CREATE TABLE queue(time_stamp datetime,sensor_id varchar(16),sensor varchar(16),param varchar(16),value float)") - else - backlog_con = assert(env:connect(backlogdb)) - end + end + backlog_con = assert(env:connect(backlogdb)) + backlog_con:execute("CREATE TABLE queue(time_stamp datetime,sensor_id varchar(16),sensor varchar(16),param varchar(16),value float)") end if logdb then if not file_exists(logdb) then touch(logdb) - log_con = assert(env:connect(logdb)) - log_con:execute("CREATE TABLE log(time_stamp datetime,sensor_id varchar(16),sensor varchar(16),param varchar(16),value float)") - log_con:execute("CREATE INDEX log_idx ON log(sensor_id,sensor,param,time_stamp)") - else - log_con = assert(env:connect(logdb)) - end + end + log_con = assert(env:connect(logdb)) + log_con:execute("CREATE TABLE log(time_stamp datetime,sensor_id varchar(16),sensor varchar(16),param varchar(16),value float)") + log_con:execute("CREATE INDEX log_idx ON log(sensor_id,sensor,param,time_stamp)") end if mqtt_host then -- 2.34.1