misc/migration/3.0.0_Any.py
author Sandrine Ribeau <sandrine.ribeau@logilab.fr>
Wed, 12 Nov 2008 16:58:35 -0800
changeset 43 c1a51436db9c
parent 0 b97547f5f1fa
child 113 1091d8d63f51
permissions -rw-r--r--
Add references chapter and lax-book-fr but this is temporary, until content is sorted.

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