I've been doing this all wrong for a long time
This commit is contained in:
parent
27b62feb5f
commit
b6558ccdd5
7 changed files with 43 additions and 31 deletions
|
@ -6,13 +6,17 @@ import re
|
|||
|
||||
from util import hook, timesince
|
||||
|
||||
db_ready = False
|
||||
|
||||
def db_init(db):
|
||||
"""check to see that our db has the tell table and return a dbection."""
|
||||
db.execute("create table if not exists tell"
|
||||
"(user_to, user_from, message, chan, time,"
|
||||
"primary key(user_to, message))")
|
||||
db.commit()
|
||||
global db_ready
|
||||
if not db_ready:
|
||||
db.execute("create table if not exists tell"
|
||||
"(user_to, user_from, message, chan, time,"
|
||||
"primary key(user_to, message))")
|
||||
db.commit()
|
||||
db_ready = True
|
||||
|
||||
return db
|
||||
|
||||
|
|
Reference in a new issue