class ActiveFacts::Generators::Traits::SQL::MySQL::MySQLDataTypeContext

Public Instance Methods

boolean_expr(safe_column_name) click to toggle source
# File lib/activefacts/generator/traits/sql/mysql.rb, line 255
def boolean_expr safe_column_name
  "#{safe_column_name} = 1"
end
boolean_type() click to toggle source

MySQL also has a BIT type, but you can specify a size up to BIT(64). This is better.

# File lib/activefacts/generator/traits/sql/mysql.rb, line 251
def boolean_type
  'BOOLEAN'     # Which is a synonym for TINYINT(1), stores 0 or 1
end
date_time_type() click to toggle source
# File lib/activefacts/generator/traits/sql/mysql.rb, line 269
def date_time_type
  # MySQL also has TIMESTAMP values, but those run from 1970/01/01 through 2038/01/19
  # DATETIME runs from 1000/01/01 through 9999/01/01
  'DATETIME'
end
default_char_type() click to toggle source
# File lib/activefacts/generator/traits/sql/mysql.rb, line 259
def default_char_type
  (@unicode ? 'N' : '') +
  'CHAR'
end
default_varchar_type() click to toggle source
# File lib/activefacts/generator/traits/sql/mysql.rb, line 264
def default_varchar_type
  (@unicode ? 'N' : '') +
  'VARCHAR'
end
integer_ranges() click to toggle source
# File lib/activefacts/generator/traits/sql/mysql.rb, line 242
def integer_ranges
  [
    ['TINYINT', -2**7, 2**7-1],
    ['TINYINT UNSIGNED', 0, 2**8-1], 
    ['MEDIUMINT', -2**23, 2**23-1], 
  ] + super
end