UniqueConstraintOperation

Constants

Methods

#create!

def create!
  return if exist?
  super
end

#default_options

def default_options
  {type: :unique}
end

#drop!

def drop!
  label_object.send(:"drop_#{type}", property, options)
end

#drop_incompatible!

def drop_incompatible!
  incompatible_operation_classes.each do |clazz|
    operation = clazz.new(label_name, property)
    operation.drop! if operation.exist?
  end
end

#exist?

def exist?
  Neo4j::Label.constraint?(label_name, property)
end

#incompatible_operation_classes

def incompatible_operation_classes
  self.class.incompatible_operation_classes
end

.incompatible_operation_classes

def self.incompatible_operation_classes
  [ExactIndexOperation]
end

#initialize

def initialize(label_name, property, options = default_options)
  @label_name = label_name.to_sym
  @property = property.to_sym
  @options = options
end
#label_name

Returns the value of attribute label_name

def label_name
  @label_name
end

#label_object

def label_object
  @label_object ||= Neo4j::Label.create(label_name)
end
#options

Returns the value of attribute options

def options
  @options
end
#property

Returns the value of attribute property

def property
  @property
end

#type

def type
  'constraint'
end