common/migration.py
changeset 2481 24bad65dbebd
parent 2476 1294a6bdf3bf
child 2512 106b2a05dc88
equal deleted inserted replaced
2480:a04caff1322e 2481:24bad65dbebd
   150                 migrdir = self.config.migration_scripts_dir()
   150                 migrdir = self.config.migration_scripts_dir()
   151             else:
   151             else:
   152                 migrdir = self.config.cube_migration_scripts_dir(cube)
   152                 migrdir = self.config.cube_migration_scripts_dir(cube)
   153             scripts = filter_scripts(self.config, migrdir, fromversion, toversion)
   153             scripts = filter_scripts(self.config, migrdir, fromversion, toversion)
   154             if scripts:
   154             if scripts:
       
   155                 prevversion = None
   155                 for version, script in scripts:
   156                 for version, script in scripts:
       
   157                     # take care to X.Y.Z_Any.py / X.Y.Z_common.py: we've to call
       
   158                     # cube_upgraded once all script of X.Y.Z have been executed
       
   159                     if prevversion is not None and version != prevversion:
       
   160                         self.cube_upgraded(cube, version)
       
   161                     prevversion = version
   156                     self.process_script(script)
   162                     self.process_script(script)
   157                     self.cube_upgraded(cube, version)
   163                 self.cube_upgraded(cube, toversion)
   158                 if version != toversion:
       
   159                     self.cube_upgraded(cube, toversion)
       
   160             else:
   164             else:
   161                 self.cube_upgraded(cube, toversion)
   165                 self.cube_upgraded(cube, toversion)
   162 
   166 
   163     def cube_upgraded(self, cube, version):
   167     def cube_upgraded(self, cube, version):
   164         pass
   168         pass