instance method rename_column_sql

Ruby on Rails 4.2.9

Since v3.2.22.5 Last seen in v4.2.9

Available in: v3.2.22.5 v4.0.13 v4.1.16 v4.2.9

Signature

rename_column_sql(table_name, column_name, new_column_name)

No documentation comment.

Parameters

table_name req
column_name req
new_column_name req
Source
# File activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb, line 805
      def rename_column_sql(table_name, column_name, new_column_name)
        column  = column_for(table_name, column_name)
        options = {
          name: new_column_name,
          default: column.default,
          null: column.null,
          auto_increment: column.extra == "auto_increment"
        }

        current_type = select_one("SHOW COLUMNS FROM #{quote_table_name(table_name)} LIKE '#{column_name}'", 'SCHEMA')["Type"]
        schema_creation.accept ChangeColumnDefinition.new column, current_type, options
      end

Defined in activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb line 805 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter

Type at least 2 characters to search.

↑↓ navigate · open · esc close