1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Properly lookup the limit for bigint

Fixes #18787.
This commit is contained in:
Sean Griffin 2015-02-02 15:20:11 -07:00
parent 35d77130a2
commit 4ec5b0d6b4
2 changed files with 11 additions and 1 deletions

View file

@ -453,7 +453,12 @@ module ActiveRecord
end
def extract_limit(sql_type) # :nodoc:
$1.to_i if sql_type =~ /\((.*)\)/
case sql_type
when /^bigint/i
8
when /\((.*)\)/
$1.to_i
end
end
def translate_exception_class(e, sql)

View file

@ -79,6 +79,11 @@ module ActiveRecord
assert_lookup_type :integer, 'bigint'
end
def test_bigint_limit
cast_type = @connection.type_map.lookup("bigint")
assert_equal 8, cast_type.limit
end
def test_decimal_without_scale
types = %w{decimal(2) decimal(2,0) numeric(2) numeric(2,0) number(2) number(2,0)}
types.each do |type|