hooks/syncschema.py
changeset 2899 3f7ce804d1e5
parent 2883 57ff19806026
child 2902 dd9f2dd02f85
equal deleted inserted replaced
2898:a485d80b8fcb 2899:3f7ce804d1e5
   932                 pending = session.transaction_data.setdefault('pendingrdefs', set())
   932                 pending = session.transaction_data.setdefault('pendingrdefs', set())
   933                 pending.add((subjschema, rschema, objschema))
   933                 pending.add((subjschema, rschema, objschema))
   934                 session.execute('DELETE X %s Y WHERE X is %s, Y is %s'
   934                 session.execute('DELETE X %s Y WHERE X is %s, Y is %s'
   935                                 % (rschema, subjschema, objschema))
   935                                 % (rschema, subjschema, objschema))
   936         execute = session.unsafe_execute
   936         execute = session.unsafe_execute
       
   937         rteid = self.eidto
   937         rset = execute('Any COUNT(X) WHERE X is %s, X relation_type R,'
   938         rset = execute('Any COUNT(X) WHERE X is %s, X relation_type R,'
   938                        'R eid %%(x)s' % rdeftype, {'x': rteid})
   939                        'R eid %%(x)s' % rdeftype, {'x': rteid})
   939         lastrel = rset[0][0] == 0
   940         lastrel = rset[0][0] == 0
   940         # we have to update physical schema systematically for final and inlined
   941         # we have to update physical schema systematically for final and inlined
   941         # relations, but only if it's the last instance for this relation type
   942         # relations, but only if it's the last instance for this relation type