Fix index creation in db

This commit is contained in:
webmaster@phyks.me 2015-11-12 23:23:41 +01:00
parent ec339b9a76
commit ed329190be
1 changed files with 2 additions and 1 deletions

View File

@ -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