misc/migration/2.99.0_Any.py
author Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
Fri, 24 Jul 2009 10:36:57 +0200
changeset 2466 c4ccfd38a542
parent 1977 606923dff11b
child 4212 ab6573088b4a
permissions -rw-r--r--
[server] take a chance to grab base-url from all-in-one config if not specified explicitly

"""

:organization: Logilab
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
from cubicweb import CW_MIGRATION_MAP

for pk, in rql('Any K WHERE X is CWProperty, X pkey IN (%s), X pkey K'
               % ','.join("'system.version.%s'" % cube for cube in CW_MIGRATION_MAP),
               ask_confirm=False):
    cube = pk.split('.')[-1]
    newk = pk.replace(cube, CW_MIGRATION_MAP[cube])
    rql('SET X pkey %(newk)s WHERE X pkey %(oldk)s',
        {'oldk': pk, 'newk': newk}, ask_confirm=False)
    print 'renamed', pk, 'to', newk

add_entity_type('CWCache')