Module: Neo4j::ActiveNode::Labels::Index::ClassMethods
- Extended by:
- Forwardable
- Defined in:
- lib/neo4j/active_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/neo4j/active_node/labels/index.rb', line 32 def constraint(property, _constraints = {type: :unique}) Neo4j::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 Neo4j::ActiveNode::Property::ClassMethods#property.
22 23 24 25 26 |
# File 'lib/neo4j/active_node/labels/index.rb', line 22 def index(property) return if Neo4j::ModelSchema.defined_constraint?(self, property) Neo4j::ModelSchema.add_defined_index(self, property) end |