changeset 11289 | 3e69bccc2022 |
11288:ab0a1863248e | 11289:3e69bccc2022 |
---|---|
1 from yams.constraints import UniqueConstraint |
|
2 |
|
3 for rschema in schema.relations(): |
|
4 if rschema.rule or not rschema.final: |
|
5 continue |
|
6 for rdef in rschema.rdefs.values(): |
|
7 if (rdef.object != 'String' |
|
8 and any(isinstance(cstr, UniqueConstraint) for cstr in rdef.constraints)): |
|
9 table = 'cw_{0}'.format(rdef.subject) |
|
10 column = 'cw_{0}'.format(rdef.rtype) |
|
11 repo.system_source.create_index(cnx, table, column, unique=True) |