# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1445440878 -7200
# Node ID d261bd7c47cf4aa9205f027c9ee2f1b47844fd34
# Parent  3d948d35d94fdd6c0d9f2df0b4e44c8e0673f4a1
[postcreate] properly set is_instance_of for bootstrap entities

Entities created before CWEType itself need the is/is_instance_of
relations created later.  We were actually only inserting "is".
Closes #7656606.

diff -r 3d948d35d94f -r d261bd7c47cf misc/migration/postcreate.py
--- a/misc/migration/postcreate.py	Wed Oct 28 17:39:30 2015 +0000
+++ b/misc/migration/postcreate.py	Wed Oct 21 17:21:18 2015 +0200
@@ -33,8 +33,8 @@
     sql('INSERT INTO %s_relation '
         'SELECT X.eid, ET.cw_eid FROM entities as X, cw_CWEType as ET '
         'WHERE X.type=ET.cw_name AND NOT EXISTS('
-        '      SELECT 1 from is_relation '
-        '      WHERE eid_from=X.eid AND eid_to=ET.cw_eid)' % rtype)
+        '      SELECT 1 from %s_relation '
+        '      WHERE eid_from=X.eid AND eid_to=ET.cw_eid)' % (rtype, rtype))
 
 # user workflow
 userwf = add_workflow(_('default user workflow'), 'CWUser')