}
private void reCreateUniqueConstraint(Label label, PrimitivePropertyMethodMetadata propertyMethodMetadata) {
PropertyMetadata propertyMetadata = ((PrimitivePropertyMethodMetadata<PropertyMetadata>) propertyMethodMetadata).getDatastoreMetadata();
ConstraintDefinition constraint = findUniqueConstraint(label, propertyMetadata.getName());
//TODO propertyMethodMetadata is always != null
if (propertyMethodMetadata != null && constraint == null) {
LOGGER.info("Creating constraint for label {} on property '{}'.", label, propertyMetadata.getName());
graphDatabaseService.schema().constraintFor(label).assertPropertyIsUnique(propertyMetadata.getName()).create();
} else if (propertyMethodMetadata == null && constraint != null) {
LOGGER.info("Dropping constraint for label {} on properties '{}'.", label, constraint.getPropertyKeys());
constraint.drop();
}
}