hooks/syncschema.py
branchstable
changeset 6002 0ce7052ce30b
parent 5891 99024ad59223
child 6076 aa7402e998a1
equal deleted inserted replaced
6001:1a21d7d2c959 6002:0ce7052ce30b
   578 
   578 
   579 
   579 
   580 class RDefUpdateOp(MemSchemaOperation):
   580 class RDefUpdateOp(MemSchemaOperation):
   581     """actually update some properties of a relation definition"""
   581     """actually update some properties of a relation definition"""
   582     rschema = rdefkey = values = None # make pylint happy
   582     rschema = rdefkey = values = None # make pylint happy
   583     oldvalues = None
   583     rdef = oldvalues = None
   584     indexed_changed = null_allowed_changed = False
   584     indexed_changed = null_allowed_changed = False
   585 
   585 
   586     def precommit_event(self):
   586     def precommit_event(self):
   587         session = self.session
   587         session = self.session
   588         rdef = self.rdef = self.rschema.rdefs[self.rdefkey]
   588         rdef = self.rdef = self.rschema.rdefs[self.rdefkey]
   602         if 'fulltextindexed' in self.values:
   602         if 'fulltextindexed' in self.values:
   603             hook.set_operation(session, 'fti_update_etypes', rdef.subject,
   603             hook.set_operation(session, 'fti_update_etypes', rdef.subject,
   604                                UpdateFTIndexOp)
   604                                UpdateFTIndexOp)
   605 
   605 
   606     def revertprecommit_event(self):
   606     def revertprecommit_event(self):
       
   607         if self.rdef is None:
       
   608             return
   607         # revert changes on in memory schema
   609         # revert changes on in memory schema
   608         self.rdef.update(self.oldvalues)
   610         self.rdef.update(self.oldvalues)
   609         # revert changes on database
   611         # revert changes on database
   610         syssource = self.session.pool.source('system')
   612         syssource = self.session.pool.source('system')
   611         if self.indexed_changed:
   613         if self.indexed_changed: