Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: plugins_base/Logger.py
- ===================================================================
- --- plugins_base/Logger.py (revision 1466)
- +++ plugins_base/Logger.py (working copy)
- @@ -49,7 +49,7 @@
- or similar'''
- CREATE_USER = '''
- - CREATE TABLE user
- + CREATE TABLE IF NOT EXISTS user
- (
- id INTEGER PRIMARY KEY,
- account TEXT
- @@ -57,7 +57,7 @@
- '''
- CREATE_CONVERSATION = '''
- - CREATE TABLE conversation
- + CREATE TABLE IF NOT EXISTS conversation
- (
- id INTEGER PRIMARY KEY,
- started INTEGER
- @@ -65,7 +65,7 @@
- '''
- CREATE_EVENT = '''
- - CREATE TABLE event
- + CREATE TABLE IF NOT EXISTS event
- (
- id INTEGER PRIMARY KEY,
- stamp INTEGER,
- @@ -74,7 +74,7 @@
- '''
- CREATE_USER_EVENT = '''
- - CREATE TABLE user_event
- + CREATE TABLE IF NOT EXISTS user_event
- (
- id_event INTEGER,
- id_user INTEGER,
- @@ -83,7 +83,7 @@
- '''
- CREATE_CONVERSATION_EVENT = '''
- - CREATE TABLE conversation_event
- + CREATE TABLE IF NOT EXISTS conversation_event
- (
- id_event INTEGER,
- id_conversation INTEGER,
- @@ -91,9 +91,9 @@
- data TEXT
- )
- '''
- - CREATE_USER_EVENT_INDEX_EVENT = 'CREATE INDEX ueidevent ON \
- + CREATE_USER_EVENT_INDEX_EVENT = 'CREATE INDEX IF NOT EXISTS ueidevent ON \
- user_event(id_event)'
- - CREATE_USER_EVENT_INDEX_USER = 'CREATE INDEX ueiduser ON \
- + CREATE_USER_EVENT_INDEX_USER = 'CREATE INDEX IF NOT EXISTS ueiduser ON \
- user_event(id_user)'
- USER_EXISTS = 'SELECT id FROM user WHERE account = ?'
- @@ -111,9 +111,6 @@
- CONVERSATION_ADD = 'INSERT INTO conversation(id, started) \
- VALUES(null, ?)'
- - CHECK_AVAIL_INDEX = 'CREATE INDEX IF NOT EXISTS ueiduser \
- - ON user_event(id_user);'
- -
- def __init__(self, path):
- '''constructor, try to open the database at path, if can not open
- it, then try to create it'''
- @@ -138,7 +135,6 @@
- self.cursor.execute(Logger.CREATE_CONVERSATION)
- self.cursor.execute(Logger.CREATE_EVENT)
- self.cursor.execute(Logger.CREATE_USER_EVENT)
- - self.cursor.execute(Logger.CHECK_AVAIL_INDEX)
- self.cursor.execute(Logger.CREATE_USER_EVENT_INDEX_EVENT)
- self.cursor.execute(Logger.CREATE_USER_EVENT_INDEX_USER)
- self.cursor.execute(Logger.CREATE_CONVERSATION_EVENT)
Add Comment
Please, Sign In to add comment