misc/migration/2.99.0_Any.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 22 May 2009 18:11:21 +0200
branchstable
changeset 1914 0ce7dbfffefd
parent 1398 5fe84a5f7035
child 1977 606923dff11b
permissions -rw-r--r--
with statement: use it or lose it

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')