summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lorrycontroller/statedb.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lorrycontroller/statedb.py b/lorrycontroller/statedb.py
index 1b885d9..db350b5 100644
--- a/lorrycontroller/statedb.py
+++ b/lorrycontroller/statedb.py
@@ -83,9 +83,11 @@ class StateDB(object):
if not existed:
self._initialise_tables()
- self.perform_any_migrations()
+ self._perform_any_migrations()
- def perform_any_migrations(self):
+ def _perform_any_migrations(self):
+ logging.debug('Performing migrations in database')
+ assert self.in_transaction
backend = yoyo.get_backend('sqlite:///' + self._filename)
migrations_dir = os.path.join(os.path.dirname(__file__), 'migrations')
migrations = yoyo.read_migrations(migrations_dir)
@@ -93,6 +95,7 @@ class StateDB(object):
def _initialise_tables(self):
logging.debug('Initialising tables in database')
+ assert self.in_transaction
c = self._conn.cursor()
# Table for holding the "are we scheduling jobs" value.