use of org.neo4j.kernel.api.exceptions.schema.IndexBelongsToConstraintException in project neo4j by neo4j.
the class Operations method indexDrop.
@Override
public void indexDrop(IndexDescriptor index) throws SchemaKernelException {
if (index == IndexDescriptor.NO_INDEX) {
throw new DropIndexFailureException("No index was specified.");
}
if (index.isTokenIndex()) {
assertTokenAndRelationshipPropertyIndexesSupported("Failed to drop token lookup index.");
}
exclusiveSchemaLock(index.schema());
exclusiveSchemaNameLock(index.getName());
assertIndexExistsForDrop(index);
if (index.isUnique()) {
if (allStoreHolder.indexGetOwningUniquenessConstraintId(index) != null) {
IndexBelongsToConstraintException cause = new IndexBelongsToConstraintException(index.schema());
throw new DropIndexFailureException("Unable to drop index: " + cause.getUserMessage(token), cause);
}
}
ktx.txState().indexDoDrop(index);
}
use of org.neo4j.kernel.api.exceptions.schema.IndexBelongsToConstraintException in project neo4j by neo4j.
the class Operations method indexDrop.
@Override
public void indexDrop(String indexName) throws SchemaKernelException {
exclusiveSchemaNameLock(indexName);
IndexDescriptor index = allStoreHolder.indexGetForName(indexName);
if (index == IndexDescriptor.NO_INDEX) {
throw new DropIndexFailureException("Unable to drop index called `" + indexName + "`. There is no such index.");
}
if (index.isTokenIndex()) {
assertTokenAndRelationshipPropertyIndexesSupported("Failed to drop token lookup index.");
}
exclusiveSchemaLock(index.schema());
assertIndexExistsForDrop(index);
if (index.isUnique()) {
if (allStoreHolder.indexGetOwningUniquenessConstraintId(index) != null) {
IndexBelongsToConstraintException cause = new IndexBelongsToConstraintException(indexName, index.schema());
throw new DropIndexFailureException("Unable to drop index: " + cause.getUserMessage(token), cause);
}
}
ktx.txState().indexDoDrop(index);
}
Aggregations