public NSArray statementsToDropPrimaryKeyConstraintsOnEntityGroups( NSArray entityGroups, EOSchemaSynchronizationModelChanges changes, EOSchemaGenerationOptions options) { if (entityGroups == null) return NSArray.EmptyArray; if (changes == null) changes = newChanges(); NSMutableArray expressions = new NSMutableArray(); for (Enumeration enumerator = entityGroups.objectEnumerator(); enumerator.hasMoreElements(); ) { NSArray entities = (NSArray) enumerator.nextElement(); EOEntity _last = (EOEntity) entities.lastObject(); // only need entity to get the table name for the group String nameInObjectStore = _nameInObjectStoreForEntityGroupWithChangeDictionary( entities, changes.changesForTableNamed(_last.externalName())); if ((nameInObjectStore != null) && (!"".equals(nameInObjectStore))) { expressions.addObject( this._expressionForString( "delete from _SYS_RELATIONSHIP where source_table = '" + nameInObjectStore + "' or dest_table = '" + nameInObjectStore + "'")); } } return expressions.immutableClone(); }
/* * [PJYF Oct 19 2004] * This is a bad hack to get WO to create indes for external keys. * We use the primary key constrain generation to create our indexes. * But we need to be carefull not to overwrite previous constrains * */ protected boolean isSinglePrimaryKeyAttribute(EOAttribute attribute) { if (attribute == null) return false; EOEntity entity = (EOEntity) attribute.entity(); if ((entity == null) || entity.isAbstractEntity() || (entity.externalName() == null)) return false; NSArray primaryKeyAttributes = entity.primaryKeyAttributes(); if (primaryKeyAttributes.count() != 1) return false; return attribute.name().equals(((EOAttribute) primaryKeyAttributes.lastObject()).name()); }