Create a new cursor in each step.

This commit is contained in:
Albert Cervera i Areny 2019-07-09 00:18:18 +02:00
parent 678328cafc
commit aede1c50f3
1 changed files with 4 additions and 2 deletions

View File

@ -249,9 +249,11 @@ class Upgrade:
if os.path.isfile(script):
# We must commit before executing the script so the script
# is not locked by our transaction
connection.commit()
logger.info(t.green('Executing: %s' % script))
self.connection.commit()
res = run(script, self.database_name, self.config_file)
self.cursor = self.connection.cursor()
if res:
logger.error(t.red('Script "%s" returned the following '
'error code: %d. Upgrade aborted.') % (script,
@ -265,9 +267,9 @@ class Upgrade:
def run(self):
self.cursor = self.connection.cursor()
for step in self.steps:
self.cursor = self.connection.cursor()
logger.info(t.green('Executing step %s...') % step.value)
if step == Step.BEFORE:
res = self.process_actions(self.before)