first implementation of protobuf
restructure in client server model loads of work still missing
This commit is contained in:
22
ledd/db_helper.py
Normal file
22
ledd/db_helper.py
Normal file
@@ -0,0 +1,22 @@
|
||||
DB_VERSION = 1
|
||||
|
||||
|
||||
def check_db(conn):
|
||||
cur = conn.cursor()
|
||||
|
||||
cur.execute("SELECT value FROM meta WHERE name='version'")
|
||||
|
||||
ver = cur.fetchone()
|
||||
if ver:
|
||||
ver = int(ver)
|
||||
|
||||
if ver < DB_VERSION:
|
||||
upgrade_db(conn, ver, DB_VERSION)
|
||||
else:
|
||||
with open('sql/ledd.sql', 'r') as f:
|
||||
cur.executescript(f.read())
|
||||
conn.commit()
|
||||
|
||||
|
||||
def upgrade_db(conn, old, new):
|
||||
pass
|
Reference in New Issue
Block a user