misc/migration/2.99.0_Any.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Thu, 14 May 2009 16:31:14 +0200
branchstable
changeset 1826 afc563537d8f
parent 1398 5fe84a5f7035
child 1977 606923dff11b
permissions -rw-r--r--
[treeview] restore functionnality lost in some previous merge #343232
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
1398
5fe84a5f7035 rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents: 176
diff changeset
     3
for pk, in rql('Any K WHERE X is CWProperty, X pkey IN (%s), X pkey K'
176
312024cbe717 don't ask confirm
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents: 138
diff changeset
     4
               % ','.join("'system.version.%s'" % cube for cube in CW_MIGRATION_MAP),
312024cbe717 don't ask confirm
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents: 138
diff changeset
     5
               ask_confirm=False):
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     6
    cube = pk.split('.')[-1]
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     7
    newk = pk.replace(cube, CW_MIGRATION_MAP[cube])
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     8
    rql('SET X pkey %(newk)s WHERE X pkey %(oldk)s',
176
312024cbe717 don't ask confirm
Sylvain Thenault <sylvain.thenault@logilab.fr>
parents: 138
diff changeset
     9
        {'oldk': pk, 'newk': newk}, ask_confirm=False)
0
b97547f5f1fa Showtime !
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    10
    print 'renamed', pk, 'to', newk
113
1091d8d63f51 [doc] add a level for better structure
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 0
diff changeset
    11
1398
5fe84a5f7035 rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents: 176
diff changeset
    12
add_entity_type('CWCache')