misc/migration/3.14.0_Any.py
author Julien Cristau <julien.cristau@logilab.fr>
Tue, 01 Jul 2014 17:25:25 +0200
changeset 9830 465d8151b92d
parent 8483 4ba11607d84a
child 10589 7c23b7de2b8d
permissions -rw-r--r--
[dbapi] allow talking to a pre-3.19 remote repository Closes #4071285
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)
8483
4ba11607d84a [entity api] unify set_attributes / set_relations into a cw_set method. Closes #2423719
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 8079
diff changeset
    12
    rqlcstr.cw_set(value=yamscstr.serialize())
8079
0f1126b9038e [3.14 migration] strip constraint value to avoid extra new lines
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 8027
diff changeset
    13
    print 'updated', rqlcstr.type, rqlcstr.value.strip()