Class: DbSchema::Operations::AlterColumnType
- Inherits:
-
Object
- Object
- DbSchema::Operations::AlterColumnType
- Defined in:
- lib/db_schema/operations.rb
Constant Summary collapse
- SERIAL_TYPES =
[:smallserial, :serial, :bigserial].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#new_attributes ⇒ Object
readonly
Returns the value of attribute new_attributes.
-
#new_type ⇒ Object
readonly
Returns the value of attribute new_type.
-
#old_type ⇒ Object
readonly
Returns the value of attribute old_type.
-
#using ⇒ Object
readonly
Returns the value of attribute using.
Instance Method Summary collapse
- #from_serial? ⇒ Boolean
-
#initialize(name, old_type:, new_type:, using: nil, **new_attributes) ⇒ AlterColumnType
constructor
A new instance of AlterColumnType.
- #to_serial? ⇒ Boolean
Constructor Details
#initialize(name, old_type:, new_type:, using: nil, **new_attributes) ⇒ AlterColumnType
Returns a new instance of AlterColumnType.
88 89 90 91 92 93 94 |
# File 'lib/db_schema/operations.rb', line 88 def initialize(name, old_type:, new_type:, using: nil, **new_attributes) @name = name @old_type = old_type @new_type = new_type @using = using @new_attributes = new_attributes end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
86 87 88 |
# File 'lib/db_schema/operations.rb', line 86 def name @name end |
#new_attributes ⇒ Object (readonly)
Returns the value of attribute new_attributes.
86 87 88 |
# File 'lib/db_schema/operations.rb', line 86 def new_attributes @new_attributes end |
#new_type ⇒ Object (readonly)
Returns the value of attribute new_type.
86 87 88 |
# File 'lib/db_schema/operations.rb', line 86 def new_type @new_type end |
#old_type ⇒ Object (readonly)
Returns the value of attribute old_type.
86 87 88 |
# File 'lib/db_schema/operations.rb', line 86 def old_type @old_type end |
#using ⇒ Object (readonly)
Returns the value of attribute using.
86 87 88 |
# File 'lib/db_schema/operations.rb', line 86 def using @using end |
Instance Method Details
#from_serial? ⇒ Boolean
96 97 98 |
# File 'lib/db_schema/operations.rb', line 96 def from_serial? SERIAL_TYPES.include?(old_type) end |
#to_serial? ⇒ Boolean
100 101 102 |
# File 'lib/db_schema/operations.rb', line 100 def to_serial? SERIAL_TYPES.include?(new_type) end |