lib/lhm/column_with_sql.rb in departure-3.0.1 vs lib/lhm/column_with_sql.rb in departure-4.0.0
- old
+ new
@@ -1,11 +1,11 @@
require 'forwardable'
module Lhm
- # Abstracts the details of a table column definition when specified with a
- # MySQL column definition string
+ # Abstracts the details of a table column definition when specified with a MySQL
+ # column definition string
class ColumnWithSql
extend Forwardable
# Returns the column's class to be used
#
@@ -51,12 +51,14 @@
# Returns the column instance with the provided data
#
# @return [column_factory]
def column
+ cast_type = ActiveRecord::Base.connection.lookup_cast_type(definition)
@column ||= self.class.column_factory.new(
name,
default_value,
+ cast_type,
definition,
null_value
)
end