class ActiveFacts::Generators::Rails::Schema::RailsDataTypeContext

Public Instance Methods

boolean_type() click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 250
def boolean_type
  'boolean'
end
date_time_type() click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 259
def date_time_type
  'datetime'
end
default_char_type() click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 263
def default_char_type
  'string'
end
default_length(data_type, type_name) click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 235
def default_length data_type, type_name
  case data_type
  when MM::DataType::TYPE_Real
    53        # IEEE Double precision floating point
  when MM::DataType::TYPE_Integer
    63
  else
    nil
  end
end
default_surrogate_length() click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 246
def default_surrogate_length
  64
end
default_text_type() click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 271
def default_text_type
  default_varchar_type
end
default_varchar_type() click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 267
def default_varchar_type
  'string'
end
integer_ranges() click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 229
def integer_ranges
  [
    ['integer', -2**63, 2**63-1]
  ]
end
surrogate_type() click to toggle source
# File lib/activefacts/generator/rails/schema.rb, line 254
def surrogate_type
  type_name, = choose_integer_range(0, 2**(default_surrogate_length-1)-1)
  type_name
end