Prepare the database whenever a connection is opened from the db_pool so that in-memory databases will work

This commit is contained in:
Mark Haines 2015-02-13 14:29:49 +00:00
parent 6375abcdac
commit 183b3d4e47
2 changed files with 7 additions and 10 deletions

View file

@ -637,10 +637,13 @@ def prepare_database(db_conn):
c.executescript(sql_script)
db_conn.commit()
else:
logger.info("Database is at version %r", user_version)
else:
sql_script = "BEGIN TRANSACTION;\n"
for sql_loc in SCHEMAS:
logger.debug("Applying schema %r", sql_loc)
sql_script += read_schema(sql_loc)
sql_script += "\n"
sql_script += "COMMIT TRANSACTION;"