Class: Dbsketch::Comparison::TableDiff

Inherits:
Diff
  • Object
show all
Defined in:
lib/dbsketch/comparison/table_comparator.rb

Instance Attribute Summary collapse

Attributes inherited from Diff

#new_value, #old_value

Instance Method Summary collapse

Methods inherited from Diff

#addition?, #change?, #deletion?

Constructor Details

#initialize(old_table, new_table, columns, primary_key, check_constraints, foreign_keys, unique_constraints) ⇒ TableDiff

Returns a new instance of TableDiff.

Raises:

  • (ArgumentError)


18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/dbsketch/comparison/table_comparator.rb', line 18

def initialize(old_table, new_table, columns, primary_key, check_constraints, foreign_keys, unique_constraints)
	super old_table, new_table
	### Preconditions
	raise ArgumentError, "old_table is not a Dbsketch::Model::Table" unless nil == old_table or old_table.is_a? Dbsketch::Model::Table
	raise ArgumentError, "new_table is not a Dbsketch::Model::Table" unless nil == new_table or new_table.is_a? Dbsketch::Model::Table
	check_constraints.each_with_index { |diff, index| raise ArgumentError, "check_constraints[#{index}] is not a Dbsketch::Comparison::CheckConstraintDiff" unless diff.is_a? Dbsketch::Comparison::CheckConstraintDiff }
	###
	@columns = columns
	@primary_key = primary_key
	@check_constraints = check_constraints
	@foreign_keys = foreign_keys
	@unique_constraints = unique_constraints
end

Instance Attribute Details

#check_constraintsObject (readonly)

Returns the value of attribute check_constraints.



32
33
34
# File 'lib/dbsketch/comparison/table_comparator.rb', line 32

def check_constraints
  @check_constraints
end

#columnsObject (readonly)

Returns the value of attribute columns.



32
33
34
# File 'lib/dbsketch/comparison/table_comparator.rb', line 32

def columns
  @columns
end

#foreign_keysObject (readonly)

Returns the value of attribute foreign_keys.



32
33
34
# File 'lib/dbsketch/comparison/table_comparator.rb', line 32

def foreign_keys
  @foreign_keys
end

#primary_keyObject (readonly)

Returns the value of attribute primary_key.



32
33
34
# File 'lib/dbsketch/comparison/table_comparator.rb', line 32

def primary_key
  @primary_key
end

#unique_constraintsObject (readonly)

Returns the value of attribute unique_constraints.



32
33
34
# File 'lib/dbsketch/comparison/table_comparator.rb', line 32

def unique_constraints
  @unique_constraints
end