Fix index creation in db
This commit is contained in:
parent
ec339b9a76
commit
ed329190be
3
velib.py
3
velib.py
@ -33,10 +33,11 @@ def db_init():
|
|||||||
"updated INTEGER, " +
|
"updated INTEGER, " +
|
||||||
"FOREIGN KEY(station_id) REFERENCES stations(id) ON DELETE CASCADE)")
|
"FOREIGN KEY(station_id) REFERENCES stations(id) ON DELETE CASCADE)")
|
||||||
c.execute("CREATE TABLE IF NOT EXISTS stationsevents(" +
|
c.execute("CREATE TABLE IF NOT EXISTS stationsevents(" +
|
||||||
"station_id INTEGER PRIMARY KEY, " +
|
"station_id INTEGER, " +
|
||||||
"timestamp INTEGER, " +
|
"timestamp INTEGER, " +
|
||||||
"event TEXT, " +
|
"event TEXT, " +
|
||||||
"FOREIGN KEY(station_id) REFERENCES stations(id) ON DELETE CASCADE)")
|
"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()
|
conn.commit()
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user