Class: RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Discourse::NoResetColumnInformationInMigrations
- Defined in:
- lib/rubocop/cop/discourse/no_reset_column_information_in_migrations.rb
Overview
Do not use ActiveRecord::ModelSchema.reset_column_information in
migrations. The method is not thread safe and we run migrations
concurrently for multisites. Also, we don't encourage the use of
ActiveRecord methods in migrations and prefer to write SQL directly.
Constant Summary collapse
- MSG =
"ActiveRecord::ModelSchema.reset_column_information is not thread-safe " \ "and we run migrations concurrently on multisite clusters. Using this " \ "method also means ActiveRecord methods are being used in migration " \ "which is discouraged at Discourse. Instead, you should write SQL in your migrations instead."
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
17 18 19 20 |
# File 'lib/rubocop/cop/discourse/no_reset_column_information_in_migrations.rb', line 17 def on_send(node) return if node.method_name != :reset_column_information add_offense(node, message: MSG) end |