Module: ActiveGraph::Node::Labels::Index::ClassMethods
- Extended by:
- Forwardable
- Defined in:
- lib/active_graph/node/labels/index.rb
Instance Method Summary collapse
-
#constraint(property, _constraints = {type: :unique}) ⇒ Object
Creates a neo4j constraint on this class for given property.
-
#index(property) ⇒ Object
Creates a Neo4j index on given property.
Instance Method Details
#constraint(property, _constraints = {type: :unique}) ⇒ Object
Creates a neo4j constraint on this class for given property
32 33 34 |
# File 'lib/active_graph/node/labels/index.rb', line 32 def constraint(property, _constraints = {type: :unique}) ActiveGraph::ModelSchema.add_defined_constraint(self, property) end |
#index(property) ⇒ Object
Creates a Neo4j index on given property
This can also be done on the property directly, see ActiveGraph::Node::Property::ClassMethods#property.
22 23 24 25 26 |
# File 'lib/active_graph/node/labels/index.rb', line 22 def index(property) return if ActiveGraph::ModelSchema.defined_constraint?(self, property) ActiveGraph::ModelSchema.add_defined_index(self, property) end |