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)



49
50
51
52
53
54
# File 'lib/arjdbc/derby/adapter.rb', line 49

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



39
40
41
42
43
44
45
46
# File 'lib/arjdbc/derby/adapter.rb', line 39

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