diff options
author | Galen Guyer <galen@galenguyer.com> | 2020-11-02 10:49:10 -0500 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2020-11-02 10:49:10 -0500 |
commit | 8634f579f03711e2490fa95d958ca07708a967f4 (patch) | |
tree | de777879cd2e5269adeeab2aea196bf9055c8f22 /migrations.py | |
parent | 459b7814546fbe98bbde0fab22bd34018fc696cb (diff) |
fix data path
Diffstat (limited to 'migrations.py')
-rw-r--r-- | migrations.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/migrations.py b/migrations.py index c5ad565..b87a82a 100644 --- a/migrations.py +++ b/migrations.py @@ -6,7 +6,7 @@ LATEST_DATA={} def create_tables(): print('creating tables') - db_conn = sqlite3.connect('./poller/data/data.sqlite3') + db_conn = sqlite3.connect('./data/data.sqlite3') c = db_conn.cursor() sql = f'CREATE TABLE IF NOT EXISTS `alertlevel` (time DATETIME PRIMARY KEY NOT NULL, color CHAR(50) NOT NULL);' c.execute(sql) @@ -26,7 +26,7 @@ def create_tables(): db_conn.close() def update_db(): - db_conn = sqlite3.connect('./poller/data/data.sqlite3') + db_conn = sqlite3.connect('./data/data.sqlite3') c = db_conn.cursor() sql = f'INSERT INTO `alertlevel` VALUES (\'{LATEST_DATA["last_updated"]}\', \'{LATEST_DATA["alert_level"]}\');' c.execute(sql) @@ -47,7 +47,7 @@ def update_db(): def get_latest_from_db(): - db_conn = sqlite3.connect('./poller/data/data.sqlite3') + db_conn = sqlite3.connect('./data/data.sqlite3') c = db_conn.cursor() sql = 'SELECT max(alertlevel.time), alertlevel.color, total.total_students, total.total_staff, new.new_students, new.new_staff, ' + \ 'quarantine.quarantine_on_campus, quarantine.quarantine_off_campus, isolation.isolation_on_campus, isolation.isolation_off_campus, ' + \ @@ -93,10 +93,8 @@ def db_is_same(): return False return True -if not os.path.exists('./poller'): - os.mkdir('./poller') -if not os.path.exists('./poller/data'): - os.mkdir('./poller/data') +if not os.path.exists('./data'): + os.mkdir('./data') create_tables() |