Class: ActiveRecord::Migration::Compatibility::V6_1::PostgreSQLCompat
- Defined in:
- activerecord/lib/active_record/migration/compatibility.rb
Class Method Summary collapse
Class Method Details
.compatible_timestamp_type(type, connection) ⇒ Object
152 153 154 155 156 157 158 159 160 161 162 |
# File 'activerecord/lib/active_record/migration/compatibility.rb', line 152 def self.(type, connection) if connection.adapter_name == "PostgreSQL" # For Rails <= 6.1, :datetime was aliased to :timestamp # See: https://github.com/rails/rails/blob/v6.1.3.2/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L108 # From Rails 7 onwards, you can define what :datetime resolves to (the default is still :timestamp) # See `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.datetime_type` type.to_sym == :datetime ? :timestamp : type else type end end |