Class: Dbsketch::Comparison::ColumnDiff

Inherits:
Diff
  • Object
show all
Defined in:
lib/dbsketch/comparison/column_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_column, new_column, type_comparator, options) ⇒ ColumnDiff

Returns a new instance of ColumnDiff.



13
14
15
16
17
18
19
20
21
22
# File 'lib/dbsketch/comparison/column_comparator.rb', line 13

def initialize old_column, new_column, type_comparator, options
	super old_column, new_column
	if change?
		@type = type_comparator.compare(old_column.type, new_column.type)
		@identity = Diff.new(old_column.identity, new_column.identity) if old_column.identity != new_column.identity
		@default = Diff.new(old_column.default, new_column.default) if old_column.default != new_column.default
		@nullable = Diff.new(old_column.nullable, new_column.nullable) if old_column.nullable != new_column.nullable
		@order = Diff.new(old_column.order, new_column.order) if options[:compare_order] and old_column.order != new_column.order
	end
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



24
25
26
# File 'lib/dbsketch/comparison/column_comparator.rb', line 24

def default
  @default
end

#identityObject (readonly)

Returns the value of attribute identity.



24
25
26
# File 'lib/dbsketch/comparison/column_comparator.rb', line 24

def identity
  @identity
end

#nullableObject (readonly)

Returns the value of attribute nullable.



24
25
26
# File 'lib/dbsketch/comparison/column_comparator.rb', line 24

def nullable
  @nullable
end

#orderObject (readonly)

Returns the value of attribute order.



24
25
26
# File 'lib/dbsketch/comparison/column_comparator.rb', line 24

def order
  @order
end

#typeObject (readonly)

Returns the value of attribute type.



24
25
26
# File 'lib/dbsketch/comparison/column_comparator.rb', line 24

def type
  @type
end