class ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter

Public Instance Methods

add_column_sql(table_name, column_name, type, options = {}) click to toggle source
# File lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract_mysql_adapter.rb, line 97
def add_column_sql(table_name, column_name, type, options = {})
  td = create_table_definition table_name, options[:temporary], options[:options]
  cd = td.new_column_definition(column_name, type, options)
  schema_creation.visit_AddColumn cd
end
change_column_sql(table_name, column_name, type, options = {}) click to toggle source
# File lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract_mysql_adapter.rb, line 103
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

  options[:name] = column.name
  schema_creation.visit_ChangeColumnDefinition ChangeColumnDefinition.new column, type, options
end
create_table_definition(name, temporary, options) click to toggle source
# File lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract_mysql_adapter.rb, line 44
def create_table_definition(name, temporary, options)
  TableDefinition.new self
end
migration_keys() click to toggle source
Calls superclass method
# File lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract_mysql_adapter.rb, line 71
def migration_keys
  super + [:unsigned]
end
schema_creation() click to toggle source
# File lib/activerecord-mysql-unsigned/active_record/v3/connection_adapters/abstract_mysql_adapter.rb, line 40
def schema_creation
  SchemaCreation.new self
end
type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false) click to toggle source
# File lib/activerecord-mysql-unsigned/active_record/v4/connection_adapters/abstract_mysql_adapter.rb, line 76
def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = false)
  case type.to_s
  when 'integer'
    case limit
    when nil, 4, 11; 'int'  # compatibility with MySQL default
    else
      type_to_sql_without_unsigned(type, limit, precision, scale)
    end.tap do |sql_type|
      sql_type << ' unsigned' if unsigned
    end
  when 'float', 'decimal'
    type_to_sql_without_unsigned(type, limit, precision, scale).tap do |sql_type|
      sql_type << ' unsigned' if unsigned
    end
  when 'primary_key'
    "#{type_to_sql(:integer, limit, precision, scale, unsigned)} auto_increment PRIMARY KEY"
  else
    type_to_sql_without_unsigned(type, limit, precision, scale)
  end
end
Also aliased as: type_to_sql_without_unsigned
type_to_sql_without_unsigned(type, limit = nil, precision = nil, scale = nil, unsigned = false)
Alias for: type_to_sql