misc/migration/3.14.0_Any.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 27 Oct 2011 10:38:02 +0200
changeset 8027 9ac82788f67b
parent 7995 9a9f35ef418c
child 8079 0f1126b9038e
permissions -rw-r--r--
[schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7954
a3d3220669d6 [cache] replace lgc.cache with something more appropriate (closes #1921713)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     1
config['rql-cache-size'] = config['rql-cache-size'] * 10
a3d3220669d6 [cache] replace lgc.cache with something more appropriate (closes #1921713)
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
diff changeset
     2
7995
9a9f35ef418c Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents: 7954
diff changeset
     3
add_entity_type('CWDataImport')
8027
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     4
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     5
from cubicweb.schema import CONSTRAINTS, guess_rrqlexpr_mainvars
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     6
for rqlcstr in rql('Any X,XT,XV WHERE X is CWConstraint, X cstrtype XT, X value XV,'
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     7
                   'X cstrtype XT, XT name IN ("RQLUniqueConstraint","RQLConstraint","RQLVocabularyConstraint"),'
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     8
                   'NOT X value ~= ";%"').entities():
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
     9
    expression = rqlcstr.value
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
    10
    mainvars = guess_rrqlexpr_mainvars(expression)
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
    11
    yamscstr = CONSTRAINTS[rqlcstr.type](expression, mainvars)
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
    12
    rqlcstr.set_attributes(value=yamscstr.serialize())
9ac82788f67b [schema, old instance] restore some pre 3.5.10 bw compat as some old instances may still have this, and add migration so we can remove it at some point
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 7995
diff changeset
    13
    print 'updated', rqlcstr.type, rqlcstr.value