[migration] fix bug when trying to add a new entity type that inherit from another stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 15 Apr 2010 18:07:33 +0200
branchstable
changeset 5293 72e102a06709
parent 5292 8b496574b65c
child 5294 ba31dd43f3c9
[migration] fix bug when trying to add a new entity type that inherit from another
server/migractions.py
--- 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