Created
June 30, 2016 07:10
-
-
Save ndnenkov/34c90ad827d3fa25b89483c8a1f31cb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActiveRecord | |
module ConnectionAdapters | |
class Column | |
private | |
def simplified_type(field_type) | |
case field_type | |
when /\bint(?:eger)?\b/i | |
:integer | |
when /\b(?:float|double)\b/i | |
:float | |
when /\b(?:decimal|numeric|number)\b/i | |
extract_scale(field_type) == 0 ? :integer : :decimal | |
when /\bdatetime\b/i | |
:datetime | |
when /\btimestamp\b/i | |
:timestamp | |
when /\btime\b/i | |
:time | |
when /\bdate\b/i | |
:date | |
when /\bclob\b/i, /\btext\b/i | |
:text | |
when /\bblob\b/i, /\bbinary\b/i | |
:binary | |
when /\bchar\b/i, /\bstring\b/i | |
:string | |
when /\bboolean\b/i | |
:boolean | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment