Module: ActiveRecord::ConnectionAdapters::OracleEnhanced::ColumnDumper
- Defined in:
- lib/activerecord/monkey_patch/rails5_0.rb
Overview
This is a monkey patch to the problem below. As a result of ‘rails db:schema:dump`, the `DATE` type column expects to return `t.datetime :created_at`. But actually `t.date :created_at` is returned.
Perhaps, converting the ‘DATE` type created in Rails 4 to `TIMESTAMP(6)` type that is used in Rails 5 makes this monkey patch unnecessary.
Original code is the following URL.
Instance Method Summary collapse
Instance Method Details
#column_spec(column) ⇒ Object
152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/activerecord/monkey_patch/rails5_0.rb', line 152 def column_spec(column) spec = Hash[(column).map { |k, v| [k, "#{k}: #{v}"] }] spec[:name] = column.name.inspect if column.virtual? spec[:type] = "virtual" else spec[:type] = schema_type(column).to_s end spec[:type] = "datetime" if spec[:type] == "date" # *** This line includes a monky patch condition. *** spec end |