misc/migration/3.14.0_Any.py
changeset 8027 9ac82788f67b
parent 7995 9a9f35ef418c
child 8079 0f1126b9038e
equal deleted inserted replaced
8026:98222e3bb804 8027:9ac82788f67b
     1 config['rql-cache-size'] = config['rql-cache-size'] * 10
     1 config['rql-cache-size'] = config['rql-cache-size'] * 10
     2 
     2 
     3 add_entity_type('CWDataImport')
     3 add_entity_type('CWDataImport')
       
     4 
       
     5 from cubicweb.schema import CONSTRAINTS, guess_rrqlexpr_mainvars
       
     6 for rqlcstr in rql('Any X,XT,XV WHERE X is CWConstraint, X cstrtype XT, X value XV,'
       
     7                    'X cstrtype XT, XT name IN ("RQLUniqueConstraint","RQLConstraint","RQLVocabularyConstraint"),'
       
     8                    'NOT X value ~= ";%"').entities():
       
     9     expression = rqlcstr.value
       
    10     mainvars = guess_rrqlexpr_mainvars(expression)
       
    11     yamscstr = CONSTRAINTS[rqlcstr.type](expression, mainvars)
       
    12     rqlcstr.set_attributes(value=yamscstr.serialize())
       
    13     print 'updated', rqlcstr.type, rqlcstr.value