server/migractions.py
branchstable
changeset 5293 72e102a06709
parent 5289 540fa73caac6
child 5302 dfd147de06b2
child 5399 03c641ae00a6
--- a/server/migractions.py	Thu Apr 15 17:57:41 2010 +0200
+++ b/server/migractions.py	Thu Apr 15 18:07:33 2010 +0200
@@ -713,7 +713,14 @@
         execute = self._cw.execute
         ss.execschemarql(execute, eschema, ss.eschema2rql(eschema, groupmap))
         # add specializes relation if needed
-        self.rqlexecall(ss.eschemaspecialize2rql(eschema), ask_confirm=confirm)
+        specialized = eschema.specializes()
+        if specialized:
+            try:
+                specialized.eid = instschema[specialized].eid
+            except KeyError:
+                raise Exception('trying to add entity type but parent type is '
+                                'not yet in the database schema')
+            self.rqlexecall(ss.eschemaspecialize2rql(eschema), ask_confirm=confirm)
         # register entity's attributes
         for rschema, attrschema in eschema.attribute_definitions():
             # ignore those meta relations, they will be automatically added