如何删除sql_constraints?
-
试了一下用继承的方式, 没效果, 看了一下orm.py里面对sql_constraint是这么处理的
<br /> for (key, con, _) in self._sql_constraints:<br /> conname = '%s_%s' % (self._table, key)<br /> cr.execute("SELECT conname FROM pg_constraint where conname=%s", (conname,))<br /> if not cr.dictfetchall():<br /> query = 'ALTER TABLE "%s" ADD CONSTRAINT "%s" %s' % (self._table, conname, con,)<br /> try:<br /> cr.execute(query)<br /> cr.commit()<br /> except:<br /> logger.notifyChannel('orm', netsvc.LOG_WARNING, 'unable to add \'%s\' constraint on table %s !\n If you want to have it, you should update the records and execute manually:\n%s' % (con, self._table, query))<br /> cr.rollback()<br /><br />
就是先前的check如果存在的话是不会被覆盖掉的, 最简单就是改account.py里面的, 然后手动把pg里面的去掉