forked from rubocop/rubocop
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…bleMigration` Fixes rubocop#5821. This PR supports the following `AR::Migration#up_only` method. ```console % cat db/migrate/example.rb class AddPublishedToPosts < ActiveRecord::Migration[5.2] def change add_column :posts, :published, :boolean, default: false up_only do execute "UPDATE posts SET published = 'true'" end end end ``` http://api.rubyonrails.org/classes/ActiveRecord/Migration.html#method-i-up_only This PR fixes the following false posive when using Rails 5.2.0. ```console % rubocop db/migrate/example.rb --only Rails/ReversibleMigration Inspecting 1 file C Offenses: db/migrate/example.rb:6:7: C: Rails/ReversibleMigration: execute is not reversible. execute "UPDATE posts SET published = 'true'" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1 file inspected, 1 offense detected ```
- Loading branch information
Showing
3 changed files
with
11 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters