Merge pull request #42995 from Shopify/internal-metadata-timestamps

Set record_timestamps = true in AR::InternalMetadata
This commit is contained in:
Jean Boussier 2021-08-11 14:56:08 +02:00 committed by GitHub
commit ea2c5ec0b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,10 @@
* Fix `ActiveRecord::InternalMetadata` to not be broken by `config.active_record.record_timestamps = false`
Since the model always create the timestamp columns, it has to set them, otherwise it breaks
various DB management tasks.
Fixes #42983
* Add `ActiveRecord::QueryLogs`.
Configurable tags can be automatically added to all SQL queries generated by Active Record.

View File

@ -10,6 +10,8 @@ module ActiveRecord
# This is enabled by default. To disable this functionality set
# `use_metadata_table` to false in your database configuration.
class InternalMetadata < ActiveRecord::Base # :nodoc:
self.record_timestamps = true
class << self
def enabled?
ActiveRecord::Base.connection.use_metadata_table?