optionsCreateTables.setObjectForKey("YES", EOSchemaGeneration.PrimaryKeyConstraintsKey);
optionsCreateTables.setObjectForKey("NO", EOSchemaGeneration.ForeignKeyConstraintsKey);
optionsCreateTables.setObjectForKey("NO", EOSchemaGeneration.CreateDatabaseKey);
optionsCreateTables.setObjectForKey("NO", EOSchemaGeneration.DropDatabaseKey);
StringBuilder sqlBuffer = new StringBuilder();
EOSynchronizationFactory sf = ((JDBCAdaptor) adaptor).plugIn().synchronizationFactory();
String creationScript = sf.schemaCreationScriptForEntities(entities, optionsCreateTables);
sqlBuffer.append(creationScript);
NSMutableArray<EOEntity> foreignKeyEntities = entities.mutableClone();
for (EOEntity entity : entities) {
for (EORelationship relationship : entity.relationships()) {
if (!relationship.isToMany()) {
EOEntity destinationEntity = relationship.destinationEntity();
if (destinationEntity.model() != entity.model()) {
foreignKeyEntities.addObject(destinationEntity);
}
}
}
}
NSMutableDictionary<String, String> optionsCreateForeignKeys = new NSMutableDictionary<String, String>();
optionsCreateForeignKeys.setObjectForKey("NO", EOSchemaGeneration.DropTablesKey);
optionsCreateForeignKeys.setObjectForKey("NO", EOSchemaGeneration.DropPrimaryKeySupportKey);
optionsCreateForeignKeys.setObjectForKey("NO", EOSchemaGeneration.CreateTablesKey);
optionsCreateForeignKeys.setObjectForKey("NO", EOSchemaGeneration.CreatePrimaryKeySupportKey);
optionsCreateForeignKeys.setObjectForKey("NO", EOSchemaGeneration.PrimaryKeyConstraintsKey);
optionsCreateForeignKeys.setObjectForKey("YES", EOSchemaGeneration.ForeignKeyConstraintsKey);
optionsCreateForeignKeys.setObjectForKey("NO", EOSchemaGeneration.CreateDatabaseKey);
optionsCreateForeignKeys.setObjectForKey("NO", EOSchemaGeneration.DropDatabaseKey);
String foreignKeyScript = sf.schemaCreationScriptForEntities(foreignKeyEntities, optionsCreateForeignKeys);
sqlBuffer.append(foreignKeyScript);
return sqlBuffer.toString();
}