define timeslots in config
This commit is contained in:
18
db.py
18
db.py
@ -39,24 +39,6 @@ def create_transmissions_table():
|
||||
else:
|
||||
log.debug('DB transmissions exists, not creating.')
|
||||
|
||||
def create_timeslots_table():
|
||||
scheme = """
|
||||
CREATE TABLE IF NOT EXISTS timeslots (
|
||||
timeslot INT NOT NULL,
|
||||
time TEXT NOT NULL,
|
||||
active BOOLEAN NOT NULL
|
||||
);
|
||||
"""
|
||||
if cursor.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='timeslots';").fetchall() == []:
|
||||
try:
|
||||
cursor.execute(scheme)
|
||||
log.info("Successfully created database transmissions")
|
||||
except sqlite3.Error as error:
|
||||
log.critical("Couldn't create timeslots table: ", error)
|
||||
exit(1)
|
||||
else:
|
||||
log.debug('DB timeslots exists, not creating.')
|
||||
|
||||
def get_transmissions(date=None, timeslot=None):
|
||||
return cursor.execute("SELECT * FROM transmissions").fetchall()
|
||||
|
||||
|
Reference in New Issue
Block a user