ClassMethods

Constants

Methods

#constraint

Creates a neo4j constraint on this class for given property

def constraint(property, constraints = {type: :unique})
  Neo4j::Session.on_next_session_available do
    declared_properties.constraint_or_fail!(property, id_property_name)
    schema_create_operation(:constraint, property, constraints)
  end
end

#constraint?

def constraint?(property)
  mapped_label.unique_constraints[:property_keys].include?([property])
end

#drop_constraint

def drop_constraint(property, constraint = {type: :unique})
  Neo4j::Session.on_next_session_available do
    declared_properties[property].unconstraint! if declared_properties[property]
    schema_drop_operation(:constraint, property, constraint)
  end
end

#drop_index

def drop_index(property, options = {})
  Neo4j::Session.on_next_session_available do
    declared_properties[property].unindex! if declared_properties[property]
    schema_drop_operation(:index, property, options)
  end
end
#index

Creates a Neo4j index on given property

This can also be done on the property directly, see Neo4j::ActiveNode::Property::ClassMethods#property.

def index(property)
  Neo4j::Session.on_next_session_available do |_|
    declared_properties.index_or_fail!(property, id_property_name)
    schema_create_operation(:index, property)
  end
end

#index?

def index?(property)
  mapped_label.indexes[:property_keys].include?([property])
end