[server] commit after serializing schema
Use separate transactions for schema serialization and postcreate
scripts execution, so that the latter can rely on the schema being
persistently stored. This matters e.g. if something in a postcreate
violates a unique_together constraint, we need the constraint persisted
in order to raise a meaningful error. See #4525069.
--- a/server/__init__.py Thu Aug 28 18:54:21 2014 +0200
+++ b/server/__init__.py Tue Nov 04 14:10:02 2014 +0100
@@ -329,6 +329,7 @@
mhandler.cmd_exec_event_script('pre%s' % event, apphome=True)
# enter instance'schema into the database
serialize_schema(cnx, schema)
+ cnx.commit()
# execute cubicweb's post<event> script
mhandler.cmd_exec_event_script('post%s' % event)
# execute cubes'post<event> script if any