lib/dm-migrations/adapters/dm-mysql-adapter.rb
# Return the signed integer column type
#
# @param [Range] range
#   the min/max allowed integers
#
# @return [String]
#
# @api private
Return the signed integer column type
Return the signed integer column type
def signed_integer_column_type(range)
          min = range.first
          max = range.last
          tinyint   = 2**7
          smallint  = 2**15
          integer   = 2**31
          mediumint = 2**23
          bigint    = 2**63
          if    min >= -tinyint   && max < tinyint   then 'TINYINT'
          elsif min >= -smallint  && max < smallint  then 'SMALLINT'
          elsif min >= -mediumint && max < mediumint then 'MEDIUMINT'
          elsif min >= -integer   && max < integer   then 'INT'
          elsif min >= -bigint    && max < bigint    then 'BIGINT'
          else
            raise ArgumentError, "min #{min} and max #{max} exceeds supported range"
          end
        end
def signed_integer_column_type ( range ) min = range . first max = range . last tinyint = 2 ** 7 smallint = 2 ** 15 integer = 2 ** 31 mediumint = 2 ** 23 bigint = 2 ** 63 if min >= - tinyint && max < tinyint then 'TINYINT' elsif min >= - smallint && max < smallint then 'SMALLINT' elsif min >= - mediumint && max < mediumint then 'MEDIUMINT' elsif min >= - integer && max < integer then 'INT' elsif min >= - bigint && max < bigint then 'BIGINT' else raise ArgumentError , "min #{min} and max #{max} exceeds supported range" end end
Return the signed integer column type
Return the signed integer column type
None
String
range
<not_specific>
<not_specific>
range the min/max allowed integers
range the min / max allowed integers
api
None