Class: ActiveGraph::Schema::UniqueConstraintOperation

Inherits:
Operation
  • Object
show all
Defined in:
lib/active_graph/schema/operation.rb

Instance Attribute Summary

Attributes inherited from Operation

#label, #options, #property

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Operation

#drop!, #drop_incompatible!, #incompatible_operation_classes, #initialize, #label_object

Constructor Details

This class inherits a constructor from ActiveGraph::Schema::Operation

Class Method Details

.incompatible_operation_classesObject



80
81
82
# File 'lib/active_graph/schema/operation.rb', line 80

def self.incompatible_operation_classes
  [ExactIndexOperation]
end

Instance Method Details

#create!Object



88
89
90
91
# File 'lib/active_graph/schema/operation.rb', line 88

def create!
  return if exist?
  super
end

#default_optionsObject



97
98
99
# File 'lib/active_graph/schema/operation.rb', line 97

def default_options
  {type: :unique}
end

#exist?Boolean

Returns:

  • (Boolean)


93
94
95
# File 'lib/active_graph/schema/operation.rb', line 93

def exist?
  label.uniqueness_constraint?(property)
end

#typeObject



84
85
86
# File 'lib/active_graph/schema/operation.rb', line 84

def type
  'uniqueness_constraint'
end