Class: Pcrd::Schema::DiffEntry
- Inherits:
-
Data
- Object
- Data
- Pcrd::Schema::DiffEntry
- Defined in:
- lib/pcrd/schema/diff_entry.rb
Overview
One row in a schema diff: describes the relationship between a source column and its counterpart on the target.
status values:
:unchanged — column exists on both sides with the same name and type
:type_changed — same name, different type
:renamed — different name, same type
:type_and_renamed — different name AND different type
:dropped — exists on source, absent from target (per spec)
:added — absent from source, new column on target (per spec)
Instance Attribute Summary collapse
-
#source_column ⇒ Object
readonly
Returns the value of attribute source_column.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#target_column ⇒ Object
readonly
Returns the value of attribute target_column.
Instance Method Summary collapse
- #added? ⇒ Boolean
- #dropped? ⇒ Boolean
- #renamed? ⇒ Boolean
- #source_name ⇒ Object
- #status_label ⇒ Object
- #target_name ⇒ Object
- #type_changed? ⇒ Boolean
Instance Attribute Details
#source_column ⇒ Object (readonly)
Returns the value of attribute source_column
15 16 17 |
# File 'lib/pcrd/schema/diff_entry.rb', line 15 def source_column @source_column end |
#status ⇒ Object (readonly)
Returns the value of attribute status
15 16 17 |
# File 'lib/pcrd/schema/diff_entry.rb', line 15 def status @status end |
#target_column ⇒ Object (readonly)
Returns the value of attribute target_column
15 16 17 |
# File 'lib/pcrd/schema/diff_entry.rb', line 15 def target_column @target_column end |
Instance Method Details
#added? ⇒ Boolean
22 |
# File 'lib/pcrd/schema/diff_entry.rb', line 22 def added? = status == :added |
#dropped? ⇒ Boolean
21 |
# File 'lib/pcrd/schema/diff_entry.rb', line 21 def dropped? = status == :dropped |
#renamed? ⇒ Boolean
20 |
# File 'lib/pcrd/schema/diff_entry.rb', line 20 def renamed? = %i[renamed type_and_renamed].include?(status) |
#source_name ⇒ Object
16 |
# File 'lib/pcrd/schema/diff_entry.rb', line 16 def source_name = source_column&.name |
#status_label ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pcrd/schema/diff_entry.rb', line 24 def status_label case status when :unchanged then "unchanged" when :type_changed then "type changed" when :renamed then "renamed" when :type_and_renamed then "renamed + type changed" when :dropped then "dropped" when :added then "added" end end |
#target_name ⇒ Object
17 |
# File 'lib/pcrd/schema/diff_entry.rb', line 17 def target_name = target_column&.name |
#type_changed? ⇒ Boolean
19 |
# File 'lib/pcrd/schema/diff_entry.rb', line 19 def type_changed? = %i[type_changed type_and_renamed].include?(status) |