Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source
Show
Ignore:
Timestamp:
03/02/08 04:42:10 (5 months ago)
Author:
nzkoz
Message:

Make the mysql schema dumper roundtrip the limits of text/blob columns. Closes #7424 [will.bryant]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb

    r8794 r8969  
    111111          return :string  if field_type =~ /enum/i 
    112112          super 
     113        end 
     114 
     115        def extract_limit(sql_type) 
     116          if sql_type =~ /blob|text/i 
     117            case sql_type 
     118            when /tiny/i 
     119              255 
     120            when /medium/i 
     121              16777215 
     122            when /long/i 
     123              2147483647 # mysql only allows 2^31-1, not 2^32-1, somewhat inconsistently with the tiny/medium/normal cases 
     124            else 
     125              super # we could return 65535 here, but we leave it undecorated by default 
     126            end 
     127          else 
     128            super 
     129          end 
    113130        end 
    114131