misc/migration/3.0.0_Any.py
author Sandrine Ribeau <sandrine.ribeau@logilab.fr>
Wed, 05 Nov 2008 13:02:09 -0800
changeset 2 3847ffe2f86c
parent 0 b97547f5f1fa
child 113 1091d8d63f51
permissions -rw-r--r--
Make SQLGenAnnotator work with GoogleAppEngine.

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