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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     1
from cubicweb import CW_MIGRATION_MAP
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     2
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     3
for pk, in rql('Any K WHERE X is EProperty, X pkey IN (%s), X pkey K'
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     4
              % ','.join("'system.version.%s'" % cube for cube in CW_MIGRATION_MAP)):
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
    cube = pk.split('.')[-1]
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     6
    newk = pk.replace(cube, CW_MIGRATION_MAP[cube])
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
    rql('SET X pkey %(newk)s WHERE X pkey %(oldk)s',
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
        {'oldk': pk, 'newk': newk})
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     9
    print 'renamed', pk, 'to', newk
113
1091d8d63f51 [doc] add a level for better structure
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 0
diff changeset
    10
1091d8d63f51 [doc] add a level for better structure
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 0
diff changeset
    11
add_entity_type('ECache')