lib/neo4j/migrations/helpers/schema.rb in neo4j-8.0.0.alpha.1 vs lib/neo4j/migrations/helpers/schema.rb in neo4j-8.0.0.alpha.2

- old
+ new

@@ -6,29 +6,27 @@ MISSING_CONSTRAINT_OR_INDEX = 'No such %{type} for %{label}#%{property}'.freeze DUPLICATE_CONSTRAINT_OR_INDEX = 'Duplicate %{type} for %{label}#%{property}'.freeze def add_constraint(label, property, options = {}) force = options[:force] || false + type = options[:type] || :uniqueness label_object = ActiveBase.label_object(label) fail_duplicate_constraint_or_index!(:constraint, label, property) if !force && label_object.constraint?(property) - label_object.create_constraint(property, type: :uniqueness) + label_object.create_constraint(property, type: type) end def add_index(label, property, options = {}) force = options[:force] || false label_object = ActiveBase.label_object(label) fail_duplicate_constraint_or_index!(:index, label, property) if !force && label_object.index?(property) label_object.create_index(property) end - def force_add_index(label, property) - add_index(label, property) - end - - def drop_constraint(label, property) + def drop_constraint(label, property, options = {}) + type = options[:type] || :uniqueness label_object = ActiveBase.label_object(label) fail_missing_constraint_or_index!(:constraint, label, property) if !label_object.constraint?(property) - label_object.drop_constraint(property, type: :uniqueness) + label_object.drop_constraint(property, type: type) end def drop_index(label, property) label_object = ActiveBase.label_object(label) fail_missing_constraint_or_index!(:index, label, property) if !label_object.index?(property)