Skip to content

Commit

Permalink
fixed: sqlite3.OperationalError: table logs already exists (#5677)
Browse files Browse the repository at this point in the history
CREATE TABLE IF NOT EXISTS
  • Loading branch information
G3G4X5X6 committed Apr 8, 2024
1 parent 29ccb7f commit 9ddf85c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/utils/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ def execute(self, statement, arguments=None):
return self.cursor.fetchall()

def init(self):
self.execute("CREATE TABLE logs(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, time TEXT, level TEXT, message TEXT)")
self.execute("CREATE TABLE data(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, status INTEGER, content_type INTEGER, value TEXT)")
self.execute("CREATE TABLE errors(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, error TEXT)")
self.execute("CREATE TABLE IF NOT EXISTS logs(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, time TEXT, level TEXT, message TEXT)")
self.execute("CREATE TABLE IF NOT EXISTS data(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, status INTEGER, content_type INTEGER, value TEXT)")
self.execute("CREATE TABLE IF NOT EXISTS errors(id INTEGER PRIMARY KEY AUTOINCREMENT, taskid INTEGER, error TEXT)")

class Task(object):
def __init__(self, taskid, remote_addr):
Expand Down

0 comments on commit 9ddf85c

Please sign in to comment.