re-create unread_messages_table if there is a missing column (this can happen to svn users only)

This commit is contained in:
Yann Leboulanger 2006-04-19 10:28:42 +00:00
parent dafb182a0f
commit 7e69364f60
1 changed files with 18 additions and 3 deletions

View File

@ -235,9 +235,24 @@ class Logger:
jid = jid.lower() jid = jid.lower()
jid_id = self.get_jid_id(jid) jid_id = self.get_jid_id(jid)
all_messages = [] all_messages = []
try:
self.cur.execute( self.cur.execute(
'SELECT message_id from unread_messages WHERE jid_id = %d' % jid_id) 'SELECT message_id from unread_messages WHERE jid_id = %d' % jid_id)
results = self.cur.fetchall() results = self.cur.fetchall()
# Remove before 0.10
except:
self.cur.executescript('DROP TABLE unread_messages;')
self.con.commit()
self.cur.executescript('''CREATE TABLE unread_messages(
message_id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
jid_id INTEGER
);''')
self.con.commit()
self.con.close()
self.jids_already_in = []
self.init_vars()
return []
for message in results: for message in results:
msg_id = message[0] msg_id = message[0]
self.cur.execute(''' self.cur.execute('''