Module: ArJdbc::Derby::Column

Defined in:
lib/arjdbc/derby/adapter.rb

Instance Method Summary collapse

Instance Method Details

#default_value(value) ⇒ Object

Post process default value from JDBC into a Rails-friendly format (columns-internal)



55
56
57
58
59
60
# File 'lib/arjdbc/derby/adapter.rb', line 55

def default_value(value)
  # jdbc returns column default strings with actual single quotes around the value.
  return $1 if value =~ /^'(.*)'$/
  return nil if value == "GENERATED_BY_DEFAULT"
  value
end

#simplified_type(field_type) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/arjdbc/derby/adapter.rb', line 44

def simplified_type(field_type)
  case field_type
  when /smallint/i  then :boolean
  when /real/i      then :float
  when /^timestamp/i then :datetime
  else
    super
  end
end