109 print 'Checking serialized schema' |
109 print 'Checking serialized schema' |
110 unique_constraints = ('SizeConstraint', 'FormatConstraint', |
110 unique_constraints = ('SizeConstraint', 'FormatConstraint', |
111 'VocabularyConstraint', 'RQLConstraint', |
111 'VocabularyConstraint', 'RQLConstraint', |
112 'RQLVocabularyConstraint') |
112 'RQLVocabularyConstraint') |
113 rql = ('Any COUNT(X),RN,EN,ECTN GROUPBY RN,EN,ECTN ORDERBY 1 ' |
113 rql = ('Any COUNT(X),RN,EN,ECTN GROUPBY RN,EN,ECTN ORDERBY 1 ' |
114 'WHERE X is EConstraint, R constrained_by X, ' |
114 'WHERE X is CWConstraint, R constrained_by X, ' |
115 'R relation_type RT, R from_entity ET, RT name RN, ' |
115 'R relation_type RT, R from_entity ET, RT name RN, ' |
116 'ET name EN, X cstrtype ECT, ECT name ECTN') |
116 'ET name EN, X cstrtype ECT, ECT name ECTN') |
117 for count, rn, en, cstrname in session.execute(rql): |
117 for count, rn, en, cstrname in session.execute(rql): |
118 if count == 1: |
118 if count == 1: |
119 continue |
119 continue |
250 % (table, column, eidcolumn, eid), |
250 % (table, column, eidcolumn, eid), |
251 {'v': default}) |
251 {'v': default}) |
252 print >> sys.stderr, ' [FIXED]' |
252 print >> sys.stderr, ' [FIXED]' |
253 else: |
253 else: |
254 print >> sys.stderr |
254 print >> sys.stderr |
255 cursor = session.system_sql('SELECT MIN(%s) FROM %sEUser;' % (eidcolumn, |
255 cursor = session.system_sql('SELECT MIN(%s) FROM %sCWUser;' % (eidcolumn, |
256 SQL_PREFIX)) |
256 SQL_PREFIX)) |
257 default_user_eid = cursor.fetchone()[0] |
257 default_user_eid = cursor.fetchone()[0] |
258 assert default_user_eid is not None, 'no user defined !' |
258 assert default_user_eid is not None, 'no user defined !' |
259 for rel, default in ( ('owned_by', default_user_eid), ): |
259 for rel, default in ( ('owned_by', default_user_eid), ): |
260 cursor = session.system_sql("SELECT eid, type FROM entities " |
260 cursor = session.system_sql("SELECT eid, type FROM entities " |