server/migractions.py
branchstable
changeset 4716 55b6a3262071
parent 4695 4aaf87e7f79e
child 4719 aaed3f813ef8
equal deleted inserted replaced
4715:d3f87ee74fe4 4716:55b6a3262071
   291             apc = osp.join(cubepath, 'migration', '%s.py' % event)
   291             apc = osp.join(cubepath, 'migration', '%s.py' % event)
   292         else:
   292         else:
   293             apc = osp.join(self.config.migration_scripts_dir(), '%s.py' % event)
   293             apc = osp.join(self.config.migration_scripts_dir(), '%s.py' % event)
   294         if osp.exists(apc):
   294         if osp.exists(apc):
   295             if self.config.free_wheel:
   295             if self.config.free_wheel:
   296                 from cubicweb.server.hooks import setowner_after_add_entity
       
   297                 self.repo.hm.unregister_hook(setowner_after_add_entity,
       
   298                                              'after_add_entity', '')
       
   299                 self.cmd_deactivate_verification_hooks()
   296                 self.cmd_deactivate_verification_hooks()
   300             self.info('executing %s', apc)
   297             self.info('executing %s', apc)
   301             confirm = self.confirm
   298             confirm = self.confirm
   302             execscript_confirm = self.execscript_confirm
   299             execscript_confirm = self.execscript_confirm
   303             self.confirm = yes
   300             self.confirm = yes
   306                 return self.cmd_process_script(apc, funcname, *args, **kwargs)
   303                 return self.cmd_process_script(apc, funcname, *args, **kwargs)
   307             finally:
   304             finally:
   308                 self.confirm = confirm
   305                 self.confirm = confirm
   309                 self.execscript_confirm = execscript_confirm
   306                 self.execscript_confirm = execscript_confirm
   310                 if self.config.free_wheel:
   307                 if self.config.free_wheel:
   311                     self.repo.hm.register_hook(setowner_after_add_entity,
       
   312                                                'after_add_entity', '')
       
   313                     self.cmd_reactivate_verification_hooks()
   308                     self.cmd_reactivate_verification_hooks()
   314 
   309 
   315     def install_custom_sql_scripts(self, directory, driver):
   310     def install_custom_sql_scripts(self, directory, driver):
   316         self.session.set_pool() # ensure pool is set
   311         self.session.set_pool() # ensure pool is set
   317         for fpath in glob(osp.join(directory, '*.sql.%s' % driver)):
   312         for fpath in glob(osp.join(directory, '*.sql.%s' % driver)):