instance method
change_column_sql
Ruby on Rails 5.0.7.2
Since v3.2.22.5 Last seen in v5.1.7Signature
change_column_sql(table_name, column_name, type, options = {})
No documentation comment.
Parameters
-
table_namereq -
column_namereq -
typereq -
optionsopt = {}
Source
# File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 754
def change_column_sql(table_name, column_name, type, options = {})
column = column_for(table_name, column_name)
unless options_include_default?(options)
options[:default] = column.default
end
unless options.has_key?(:null)
options[:null] = column.null
end
td = create_table_definition(table_name)
cd = td.new_column_definition(column.name, type, options)
schema_creation.accept(ChangeColumnDefinition.new(cd, column.name))
end
Defined in activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb line 754
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter