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

Add change_column to Rails/ReversibleMigration #591

Closed
mattmccormick opened this issue Dec 2, 2021 · 0 comments
Closed

Add change_column to Rails/ReversibleMigration #591

mattmccormick opened this issue Dec 2, 2021 · 0 comments

Comments

@mattmccormick
Copy link
Contributor

Is your feature request related to a problem? Please describe.

change_column is not on the list of the migration definitions supported by the change method. This is easy to miss as there are a couple change_column_* methods that are supported.

When trying to rollback a migration that uses change_column in the change method, the following error will be displayed and the rollback will fail:

StandardError: An error has occurred, this and all later migrations canceled:

This migration uses change_column, which is not automatically reversible.
To make the migration reversible you can either:
1. Define #up and #down methods in place of the #change method.
2. Use the #reversible method to define reversible behavior.

Describe the solution you'd like

Add change_column to the ReversibleMigration cop.

Describe alternatives you've considered

Trying to remember this instead :)

Additional context

none

@mattmccormick mattmccormick changed the title Add change_column to ReversibleMigration Add change_column to Rails/ReversibleMigration Dec 2, 2021
mattmccormick added a commit to mattmccormick/rubocop-rails that referenced this issue Dec 2, 2021
…tion`

`change_column` is not on the list of the migration definitions supported by the `change` method. This is easy to miss as there are a couple `change_column_*` methods that are supported.

When trying to rollback a migration that uses `change_column` in the `change` method, the rollback will fail.  This change adds the check to `Rails/ReversibleMigration`.
@koic koic closed this as completed in 104e5c9 Dec 4, 2021
koic added a commit that referenced this issue Dec 4, 2021
…olumn-in-change-method

[Fix #591] Add `change_column` check to `Rails/ReversibleMigration`
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