misc/migration/3.3.5_Any.py
author Florent Cayre <florent.cayre@logilab.fr>
Mon, 15 Jul 2013 17:34:54 +0200
branchstable
changeset 9156 3125d8a13b03
parent 2588 3a590ff82e99
child 8798 cdab3aadc679
permissions -rw-r--r--
Added tag cubicweb-centos-version-3.16.6-1, cubicweb-debian-version-3.16.6-1, cubicweb-version-3.16.6 for changeset b4ccaf13081d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2588
3a590ff82e99 [F schema serial] #344876: missing some 'is'/'is_instance_of' relation for newly created instances
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     1
# some entities have been added before schema entities, fix the 'is' and
3a590ff82e99 [F schema serial] #344876: missing some 'is'/'is_instance_of' relation for newly created instances
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     2
# 'is_instance_of' relations
3a590ff82e99 [F schema serial] #344876: missing some 'is'/'is_instance_of' relation for newly created instances
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     3
for rtype in ('is', 'is_instance_of'):
3a590ff82e99 [F schema serial] #344876: missing some 'is'/'is_instance_of' relation for newly created instances
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     4
    sql('INSERT INTO %s_relation '
3a590ff82e99 [F schema serial] #344876: missing some 'is'/'is_instance_of' relation for newly created instances
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     5
        'SELECT X.eid, ET.cw_eid FROM entities as X, cw_CWEType as ET '
3a590ff82e99 [F schema serial] #344876: missing some 'is'/'is_instance_of' relation for newly created instances
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     6
        'WHERE X.type=ET.cw_name AND NOT EXISTS('
3a590ff82e99 [F schema serial] #344876: missing some 'is'/'is_instance_of' relation for newly created instances
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     7
        '      SELECT 1 from is_relation '
3a590ff82e99 [F schema serial] #344876: missing some 'is'/'is_instance_of' relation for newly created instances
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
diff changeset
     8
        '      WHERE eid_from=X.eid AND eid_to=ET.cw_eid)' % rtype)