class Mv::Core::Services::DeleteConstraints

Attributes

tables[R]

Public Class Methods

new(tables = []) click to toggle source
# File lib/mv/core/services/delete_constraints.rb, line 9
def initialize(tables = [])
  @tables = tables.present? ? tables : Mv::Core::Db::MigrationValidator.pluck(:table_name)
end

Public Instance Methods

execute() click to toggle source
# File lib/mv/core/services/delete_constraints.rb, line 13
def execute
  constraints_comparizon = Mv::Core::Services::CompareConstraintArrays.new(existing_constraints, [])
                                                                      .execute
  Mv::Core::Services::SynchronizeConstraints.new(constraints_comparizon[:added], 
                                                 constraints_comparizon[:updated], 
                                                 constraints_comparizon[:deleted])
                                            .execute
end

Private Instance Methods

existing_constraints() click to toggle source
# File lib/mv/core/services/delete_constraints.rb, line 24
def existing_constraints
  Mv::Core::Services::LoadConstraints.new(tables).execute
end