aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/mysql/column.rb
blob: c66d543752ef70b8327d174991e3c54dd5e3e91d (plain) (tree)
1
2
3
4
5
6
7
8
9



                                                         
                                                                
 
                     
                                                                      
                                                                                 


                           
                                                 


                           
                                   
           



         
module ActiveRecord
  module ConnectionAdapters
    module MySQL
      class Column < ConnectionAdapters::Column # :nodoc:
        delegate :extra, to: :sql_type_metadata, allow_nil: true

        def unsigned?
          # enum and set types do not allow being defined as unsigned.
          !/\A(?:enum|set)\b/.match?(sql_type) && /\bunsigned\b/.match?(sql_type)
        end

        def case_sensitive?
          collation && !/_ci\z/.match?(collation)
        end

        def auto_increment?
          extra == "auto_increment"
        end
      end
    end
  end
end