take care to migration w/ X.Y.Z_Any.py / X.Y.Z_common.py
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 24 Jul 2009 15:13:02 +0200
changeset 2481 24bad65dbebd
parent 2480 a04caff1322e
child 2486 00f3b102b2c5
take care to migration w/ X.Y.Z_Any.py / X.Y.Z_common.py
common/migration.py
--- a/common/migration.py	Fri Jul 24 15:12:40 2009 +0200
+++ b/common/migration.py	Fri Jul 24 15:13:02 2009 +0200
@@ -152,11 +152,15 @@
                 migrdir = self.config.cube_migration_scripts_dir(cube)
             scripts = filter_scripts(self.config, migrdir, fromversion, toversion)
             if scripts:
+                prevversion = None
                 for version, script in scripts:
+                    # take care to X.Y.Z_Any.py / X.Y.Z_common.py: we've to call
+                    # cube_upgraded once all script of X.Y.Z have been executed
+                    if prevversion is not None and version != prevversion:
+                        self.cube_upgraded(cube, version)
+                    prevversion = version
                     self.process_script(script)
-                    self.cube_upgraded(cube, version)
-                if version != toversion:
-                    self.cube_upgraded(cube, toversion)
+                self.cube_upgraded(cube, toversion)
             else:
                 self.cube_upgraded(cube, toversion)