[migration] fix bug when trying to add a new entity type that inherit from another
--- 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