128 |
128 |
129 def check_schema(schema, session, eids, fix=1): |
129 def check_schema(schema, session, eids, fix=1): |
130 """check serialized schema""" |
130 """check serialized schema""" |
131 print 'Checking serialized schema' |
131 print 'Checking serialized schema' |
132 unique_constraints = ('SizeConstraint', 'FormatConstraint', |
132 unique_constraints = ('SizeConstraint', 'FormatConstraint', |
133 'VocabularyConstraint', 'RQLConstraint', |
133 'VocabularyConstraint', |
134 'RQLVocabularyConstraint') |
134 'RQLVocabularyConstraint') |
135 rql = ('Any COUNT(X),RN,SN,ON,CTN GROUPBY RN,SN,ON,CTN ORDERBY 1 ' |
135 rql = ('Any COUNT(X),RN,SN,ON,CTN GROUPBY RN,SN,ON,CTN ORDERBY 1 ' |
136 'WHERE X is CWConstraint, R constrained_by X, ' |
136 'WHERE X is CWConstraint, R constrained_by X, ' |
137 'R relation_type RT, RT name RN, R from_entity ST, ST name SN, ' |
137 'R relation_type RT, RT name RN, R from_entity ST, ST name SN, ' |
138 'R to_entity OT, OT name ON, X cstrtype CT, CT name CTN') |
138 'R to_entity OT, OT name ON, X cstrtype CT, CT name CTN') |
140 if count == 1: |
140 if count == 1: |
141 continue |
141 continue |
142 if cstrname in unique_constraints: |
142 if cstrname in unique_constraints: |
143 print "ERROR: got %s %r constraints on relation %s.%s.%s" % ( |
143 print "ERROR: got %s %r constraints on relation %s.%s.%s" % ( |
144 count, cstrname, sn, rn, on) |
144 count, cstrname, sn, rn, on) |
|
145 if fix: |
|
146 print 'dunno how to fix, do it yourself' |
145 |
147 |
146 |
148 |
147 |
149 |
148 def check_text_index(schema, session, eids, fix=1): |
150 def check_text_index(schema, session, eids, fix=1): |
149 """check all entities registered in the text index""" |
151 """check all entities registered in the text index""" |