Skip to content

Commit

Permalink
Merge pull request #1252 from Earlopain/disable-unused-ignored-columns
Browse files Browse the repository at this point in the history
[Fix #1249] Disable `Rails/UnusedIgnoredColumns` by default
  • Loading branch information
koic committed Mar 31, 2024
2 parents 4d25c6e + f60be8d commit 0cd57a8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/change_disable_rails_unused_ignored_columns.md
@@ -0,0 +1 @@
* [#1249](https://github.com/rubocop/rubocop-rails/issues/1249): Disable `Rails/UnusedIgnoredColumns` by default. ([@earlopain][])
3 changes: 2 additions & 1 deletion config/default.yml
Expand Up @@ -1163,8 +1163,9 @@ Rails/UnknownEnv:

Rails/UnusedIgnoredColumns:
Description: 'Remove a column that does not exist from `ignored_columns`.'
Enabled: pending
Enabled: false
VersionAdded: '2.11'
VersionChanged: <<next>>
Include:
- app/models/**/*.rb

Expand Down
6 changes: 6 additions & 0 deletions lib/rubocop/cop/rails/unused_ignored_columns.rb
Expand Up @@ -7,6 +7,12 @@ module Rails
# `ignored_columns` is necessary to drop a column from RDBMS, but you don't need it after the migration
# to drop the column. You avoid forgetting to remove `ignored_columns` by this cop.
#
# IMPORTANT: This cop can't be used to effectively check for unused columns because the development
# and production schema can be out of sync until the migration has been run on production. As such,
# this cop can cause `ignored_columns` to be removed even though the production schema still contains
# the column, which can lead to downtime when the migration is actually executed. Only enable this cop
# if you know your migrations will be run before any of your Rails applications boot with the modified code.
#
# @example
# # bad
# class User < ApplicationRecord
Expand Down

0 comments on commit 0cd57a8

Please sign in to comment.