From ed329190be0d402ef18cddf6041213f3633a00a8 Mon Sep 17 00:00:00 2001 From: "webmaster@phyks.me" Date: Thu, 12 Nov 2015 23:23:41 +0100 Subject: [PATCH] Fix index creation in db --- velib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/velib.py b/velib.py index b2f47e2..8a48af8 100755 --- a/velib.py +++ b/velib.py @@ -33,10 +33,11 @@ def db_init(): "updated INTEGER, " + "FOREIGN KEY(station_id) REFERENCES stations(id) ON DELETE CASCADE)") c.execute("CREATE TABLE IF NOT EXISTS stationsevents(" + - "station_id INTEGER PRIMARY KEY, " + + "station_id INTEGER, " + "timestamp INTEGER, " + "event TEXT, " + "FOREIGN KEY(station_id) REFERENCES stations(id) ON DELETE CASCADE)") + c.execute("CREATE INDEX IF NOT EXISTS stationsevents_station_id ON stationsevents (station_id)"); conn.commit() return conn