Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Unsigned integer type with 10 digits can potentially contain values

which don't fit signed integer type. Regard such columns as Bignum,
so that bigint type will be used in target database.
  • Loading branch information...
commit 3b034b1d1101e1d6a5e908df004af646f6140cbf 1 parent 7f2f6e0
@r-stu31 r-stu31 authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/sequel/extensions/schema_dumper.rb
View
10 lib/sequel/extensions/schema_dumper.rb
@@ -149,8 +149,14 @@ def column_schema_to_generator_opts(name, schema, options)
# database type is not recognized, return it as a String type.
def column_schema_to_ruby_type(schema)
case t = schema[:db_type].downcase
- when /\A(?:medium|small)?int(?:eger)?(?:\((?:\d+)\))?(?: unsigned)?\z/o
- {:type=>Integer}
+ when /\A(medium|small)?int(?:eger)?(?:\((\d+)\))?( unsigned)?\z/o
+ if !$1 && $2 && $2.to_i >= 10 && $3
+ # Unsigned integer type with 10 digits can potentially contain values which
+ # don't fit signed integer type, so use bigint type in target database.
+ {:type=>Bignum}
+ else
+ {:type=>Integer}
+ end
when /\Atinyint(?:\((\d+)\))?(?: unsigned)?\z/o
{:type =>schema[:type] == :boolean ? TrueClass : Integer}
when /\Abigint(?:\((?:\d+)\))?(?: unsigned)?\z/o
Please sign in to comment.
Something went wrong with that request. Please try again.