|
|
|
@ -43,7 +43,6 @@ from .keys import KeyStore |
|
|
|
|
import json |
|
|
|
|
import logging |
|
|
|
|
import os |
|
|
|
|
import sqlite3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__) |
|
|
|
@ -370,13 +369,10 @@ def read_schema(schema): |
|
|
|
|
return schema_file.read() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def prepare_database(db_name): |
|
|
|
|
def prepare_database(db_conn): |
|
|
|
|
""" Set up all the dbs. Since all the *.sql have IF NOT EXISTS, so we |
|
|
|
|
don't have to worry about overwriting existing content. |
|
|
|
|
""" |
|
|
|
|
logging.info("Preparing database: %s...", db_name) |
|
|
|
|
|
|
|
|
|
with sqlite3.connect(db_name) as db_conn: |
|
|
|
|
c = db_conn.cursor() |
|
|
|
|
c.execute("PRAGMA user_version") |
|
|
|
|
row = c.fetchone() |
|
|
|
@ -410,4 +406,3 @@ def prepare_database(db_name): |
|
|
|
|
|
|
|
|
|
c.close() |
|
|
|
|
|
|
|
|
|
logging.info("Database prepared in %s.", db_name) |
|
|
|
|