[migration] add rollback when replace_eid_sequence_with_eid_numrange fails
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 17 Feb 2016 14:01:35 +0100
changeset 11246 ceb0e8e9129e
parent 11245 20b2e7ceecf6
child 11247 518eb10adcd5
[migration] add rollback when replace_eid_sequence_with_eid_numrange fails If we get here, the current transaction is aborted, so if we are to assume everything is fine and continue we need to rollback first.
cubicweb/misc/migration/bootstrapmigration_repository.py
--- a/cubicweb/misc/migration/bootstrapmigration_repository.py	Wed Feb 17 14:03:56 2016 +0100
+++ b/cubicweb/misc/migration/bootstrapmigration_repository.py	Wed Feb 17 14:01:35 2016 +0100
@@ -45,6 +45,7 @@
         cursor.execute(dbh.sql_sequence_current_state('entities_id_seq'))
         lasteid = cursor.fetchone()[0]
     except: # programming error, already migrated
+        session.rollback()
         return
 
     cursor.execute(dbh.sql_drop_sequence('entities_id_seq'))