|Re: [CDO] How to manually create DDL for schema updates? [message #1809682 is a reply to message #1809675]
||Sat, 20 July 2019 07:02
|| Eike Stepper
Registered: July 2009
I see, you don't want to generate the DDL for the new schema, but for the delta between old and new schema, right?
The ensureSchema() call in DBStore.doActivate() only makes sure that CDO's system tables exist, as defined by CDODBSchema.INSTANCE. As you found out, the attribute and list tables of the mapped EClasses are created lazily by default, see AbstractHorizontalClassMapping and XyzListTableWithRanges. You can create those tables eagerly with <property name="eagerTableCreation" value="true"/> under the <mappingStrategy> element in cdo-server.xml. You may also want to use the <initialPackage> element under the <repository> element, see the example in cdo-server.xml.
You can generate your DLL for IDBSchemaDeltas with the following code:
public void notifyEvent(IEvent event)
if (event instanceof SchemaChangedEvent)
SchemaChangedEvent e = (SchemaChangedEvent)event;
IDBSchemaDelta schemaDelta = e.getSchemaDelta();
// Manually generate schema using the delta...
Unfortunately at the moment I see no way to add this listener right after the database instance is created, so you can only patch DBStore.doActivate(). I can add a respective hook if you submit a bugzilla. I can probably also find a way then to customize the IDBDeltaVisitor.Filter.Policy for IDBSchemaTransaction.ensureSchema(IDBSchema).
Powered by FUDForum
. Page generated in 0.01922 seconds