Class: RuboCop::Cop::Migration::RenameTable
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Migration::RenameTable
- Defined in:
- lib/rubocop/cop/migration/rename_table.rb
Overview
Avoid renaming tables that are in use.
It will cause errors in your application. A safer approach is to:
-
Create a new table
-
Write to both tables
-
Backfill data from the old table to new table
-
Move reads from the old table to the new table
-
Stop writing to the old table
-
Drop the old table
Constant Summary collapse
- MSG =
'Avoid renaming tables that are in use.'- RESTRICT_ON_SEND =
%i[ rename_table ].freeze
Instance Method Summary collapse
- #on_send(node) ⇒ void (also: #on_csend)
Instance Method Details
#on_send(node) ⇒ void Also known as: on_csend
This method returns an undefined value.
52 53 54 55 56 |
# File 'lib/rubocop/cop/migration/rename_table.rb', line 52 def on_send(node) return unless bad?(node) add_offense(node) end |