Module: ActiveRecord::DatabaseUnsignedColumns::Adapters::JdbcMysqlAdapter

Extended by:
ActiveSupport::Concern
Defined in:
lib/active_record/database_unsigned_columns/adapters/jdbc_mysql_adapter.rb

Instance Method Summary collapse

Instance Method Details

#modify_types_with_unsigned(types) ⇒ Object



17
18
19
20
21
# File 'lib/active_record/database_unsigned_columns/adapters/jdbc_mysql_adapter.rb', line 17

def modify_types_with_unsigned(types)
  types = modify_types_without_unsigned(types)
  types[:primary_key] = "INT UNSIGNED DEFAULT NULL auto_increment PRIMARY KEY" if types.has_key? :primary_key
  types
end

#type_to_sql_with_unsigned(type, limit = nil, precision = nil, scale = nil, unsigned = false) ⇒ Object



23
24
25
26
27
# File 'lib/active_record/database_unsigned_columns/adapters/jdbc_mysql_adapter.rb', line 23

def type_to_sql_with_unsigned(type, limit = nil, precision = nil, scale = nil, unsigned = false)
  sql = type_to_sql_without_unsigned(type, limit, precision, scale)
  sql << ' UNSIGNED' if unsigned && (['integer', 'decimal', 'float', 'boolean'].include? type.to_s)
  sql
end