This repository has been archived by the owner on Aug 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mostly working with strong_migrations integration
- Loading branch information
Showing
6 changed files
with
80 additions
and
21 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module RuboCop | ||
module Migration | ||
class StrongMigrationsChecker | ||
include StrongMigrations::Migration | ||
|
||
def version_safe? | ||
false | ||
end | ||
|
||
def postgresql? | ||
true | ||
end | ||
|
||
def check_operation(method_name, *args) | ||
send(method_name, *args) | ||
rescue StrongMigrations::UnsafeMigration => e | ||
strip_wait_message(e.message) | ||
rescue NoMethodError | ||
# Do nothing, this method is unrecognized by StrongMigrations unsafe | ||
# operations and is likely safe. | ||
end | ||
|
||
private | ||
|
||
def strip_wait_message(error_message) | ||
error_message.split("\n\n", 2).last | ||
end | ||
end | ||
end | ||
end |
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