Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IrreversibleMigration too strict? Using almost any method causes an offense even when the migration is reversible #48

Open
dentarg opened this issue Nov 25, 2024 · 0 comments

Comments

@dentarg
Copy link

dentarg commented Nov 25, 2024

Silly example but

Sequel.migration do
  change do
    alter_table :cars do
      add_column 'foo' + 'bar', :text
    end
  end
end
$ bundle e rubocop --only Sequel/IrreversibleMigration migrations/003_test.rb
Inspecting 1 file
C

Offenses:

migrations/003_test.rb:6:24: C: Sequel/IrreversibleMigration: Avoid using "+" inside a "change" block. Use "up" & "down" blocks instead.
      add_column 'foo' + 'bar', :text
                       ^

1 file inspected, 1 offense detected

I assume the docs, that say this

The change block can usually correctly reverse the following methods: ...

means that there are migration methods in Sequel that isn't reversible, and it is those this cop wants to catch. Here's a recent example where one such method was made reversible jeremyevans/sequel#2060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant