hooks/syncschema.py
changeset 6333 e3994fcc21c3
parent 6279 42079f752a9c
parent 6294 a1535abe6ab2
child 6426 541659c39f6a
equal deleted inserted replaced
6293:df44d7163582 6333:e3994fcc21c3
   703         prefix = SQL_PREFIX
   703         prefix = SQL_PREFIX
   704         table = '%s%s' % (prefix, self.entity.constraint_of[0].name)
   704         table = '%s%s' % (prefix, self.entity.constraint_of[0].name)
   705         cols = ['%s%s' % (prefix, r.rtype.name)
   705         cols = ['%s%s' % (prefix, r.rtype.name)
   706                 for r in self.entity.relations]
   706                 for r in self.entity.relations]
   707         dbhelper= session.pool.source('system').dbhelper
   707         dbhelper= session.pool.source('system').dbhelper
   708         sql = dbhelper.sql_create_multicol_unique_index(table, cols)
   708         sqls = dbhelper.sqls_create_multicol_unique_index(table, cols)
   709         session.system_sql(sql)
   709         for sql in sqls:
       
   710             session.system_sql(sql)
   710 
   711 
   711     # XXX revertprecommit_event
   712     # XXX revertprecommit_event
   712 
   713 
   713     def postcommit_event(self):
   714     def postcommit_event(self):
   714         eschema = self.session.vreg.schema.schema_by_eid(self.entity.constraint_of[0].eid)
   715         eschema = self.session.vreg.schema.schema_by_eid(self.entity.constraint_of[0].eid)
   722         session = self.session
   723         session = self.session
   723         prefix = SQL_PREFIX
   724         prefix = SQL_PREFIX
   724         table = '%s%s' % (prefix, self.entity.type)
   725         table = '%s%s' % (prefix, self.entity.type)
   725         dbhelper= session.pool.source('system').dbhelper
   726         dbhelper= session.pool.source('system').dbhelper
   726         cols = ['%s%s' % (prefix, c) for c in self.cols]
   727         cols = ['%s%s' % (prefix, c) for c in self.cols]
   727         sql = dbhelper.sql_drop_multicol_unique_index(table, cols)
   728         sqls = dbhelper.sqls_drop_multicol_unique_index(table, cols)
   728         session.system_sql(sql)
   729         for sql in sqls:
       
   730             session.system_sql(sql)
   729 
   731 
   730     # XXX revertprecommit_event
   732     # XXX revertprecommit_event
   731 
   733 
   732     def postcommit_event(self):
   734     def postcommit_event(self):
   733         eschema = self.session.vreg.schema.schema_by_eid(self.entity.eid)
   735         eschema = self.session.vreg.schema.schema_by_eid(self.entity.eid)