misc/migration/2.99.0_Any.py
author Laure Bourgois <Laure.Bourgois@logilab.fr>
Wed, 26 Nov 2008 10:20:27 +0100
changeset 149 a7cd4296a85e
parent 138 ed8a7efaadb6
child 176 312024cbe717
permissions -rw-r--r--
cleaning code

from cubicweb import CW_MIGRATION_MAP

for pk, in rql('Any K WHERE X is EProperty, X pkey IN (%s), X pkey K'
              % ','.join("'system.version.%s'" % cube for cube in CW_MIGRATION_MAP)):
    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})
    print 'renamed', pk, 'to', newk

add_entity_type('ECache')