Module: ActiveRecord::Mysql::Awesome::Column

Included in:
ConnectionAdapters::AbstractMysqlAdapter::Column
Defined in:
lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb,
lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb

Instance Method Summary collapse

Instance Method Details

#auto_increment?Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb', line 130

def auto_increment?
  extra == 'auto_increment'
end

#bigint?Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb', line 126

def bigint?
  sql_type =~ /bigint/i
end

#extract_limit(sql_type) ⇒ Object



163
164
165
166
167
168
169
# File 'lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb', line 163

def extract_limit(sql_type)
  case sql_type
  when /time/i; nil
  else
    super
  end
end

#extract_precision(sql_type) ⇒ Object



171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb', line 171

def extract_precision(sql_type)
  case sql_type
  when /time/i
    if sql_type =~ /\((\d+)(,\d+)?\)/
      $1.to_i
    else
      0
    end
  else
    super
  end
end

#unsigned?Boolean

Returns:

  • (Boolean)


122
123
124
# File 'lib/activerecord-mysql-awesome/active_record/connection_adapters/abstract_mysql_adapter.rb', line 122

def unsigned?
  sql_type =~ /unsigned/i
end