diff options
Diffstat (limited to 'rubocop/cop/migration')
-rw-r--r-- | rubocop/cop/migration/add_column_with_default.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_concurrent_foreign_key.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_concurrent_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_limit_to_text_columns.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/add_timestamps.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/datetime.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/hash_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/prevent_strings.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/remove_column.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/remove_concurrent_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/remove_index.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/safer_boolean_column.rb | 6 | ||||
-rw-r--r-- | rubocop/cop/migration/timestamps.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/update_column_in_batches.rb | 2 | ||||
-rw-r--r-- | rubocop/cop/migration/with_lock_retries_disallowed_method.rb | 1 | ||||
-rw-r--r-- | rubocop/cop/migration/with_lock_retries_with_change.rb | 2 |
17 files changed, 19 insertions, 18 deletions
diff --git a/rubocop/cop/migration/add_column_with_default.rb b/rubocop/cop/migration/add_column_with_default.rb index 355319b0dfe..afd7d93cd47 100644 --- a/rubocop/cop/migration/add_column_with_default.rb +++ b/rubocop/cop/migration/add_column_with_default.rb @@ -8,7 +8,7 @@ module RuboCop class AddColumnWithDefault < RuboCop::Cop::Cop include MigrationHelpers - MSG = '`add_column_with_default` is deprecated, use `add_column` instead'.freeze + MSG = '`add_column_with_default` is deprecated, use `add_column` instead' def on_send(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/add_concurrent_foreign_key.rb b/rubocop/cop/migration/add_concurrent_foreign_key.rb index 957bd30af63..ebab6aa653e 100644 --- a/rubocop/cop/migration/add_concurrent_foreign_key.rb +++ b/rubocop/cop/migration/add_concurrent_foreign_key.rb @@ -10,7 +10,7 @@ module RuboCop class AddConcurrentForeignKey < RuboCop::Cop::Cop include MigrationHelpers - MSG = '`add_foreign_key` requires downtime, use `add_concurrent_foreign_key` instead'.freeze + MSG = '`add_foreign_key` requires downtime, use `add_concurrent_foreign_key` instead' def_node_matcher :false_node?, <<~PATTERN (false) diff --git a/rubocop/cop/migration/add_concurrent_index.rb b/rubocop/cop/migration/add_concurrent_index.rb index 510f98ce373..bfe7c15bfdf 100644 --- a/rubocop/cop/migration/add_concurrent_index.rb +++ b/rubocop/cop/migration/add_concurrent_index.rb @@ -11,7 +11,7 @@ module RuboCop include MigrationHelpers MSG = '`add_concurrent_index` is not reversible so you must manually define ' \ - 'the `up` and `down` methods in your migration class, using `remove_concurrent_index` in `down`'.freeze + 'the `up` and `down` methods in your migration class, using `remove_concurrent_index` in `down`' def on_send(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/add_index.rb b/rubocop/cop/migration/add_index.rb index 7415880e554..327e89fb040 100644 --- a/rubocop/cop/migration/add_index.rb +++ b/rubocop/cop/migration/add_index.rb @@ -9,7 +9,7 @@ module RuboCop class AddIndex < RuboCop::Cop::Cop include MigrationHelpers - MSG = '`add_index` requires downtime, use `add_concurrent_index` instead'.freeze + MSG = '`add_index` requires downtime, use `add_concurrent_index` instead' def on_def(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/add_limit_to_text_columns.rb b/rubocop/cop/migration/add_limit_to_text_columns.rb index 126e4e21f22..f45551e60a4 100644 --- a/rubocop/cop/migration/add_limit_to_text_columns.rb +++ b/rubocop/cop/migration/add_limit_to_text_columns.rb @@ -14,7 +14,7 @@ module RuboCop include MigrationHelpers MSG = 'Text columns should always have a limit set (255 is suggested). ' \ - 'You can add a limit to a `text` column by using `add_text_limit`'.freeze + 'You can add a limit to a `text` column by using `add_text_limit`' def_node_matcher :reverting?, <<~PATTERN (def :down ...) diff --git a/rubocop/cop/migration/add_timestamps.rb b/rubocop/cop/migration/add_timestamps.rb index d16e8b1f45b..01d3f01ef4f 100644 --- a/rubocop/cop/migration/add_timestamps.rb +++ b/rubocop/cop/migration/add_timestamps.rb @@ -9,7 +9,7 @@ module RuboCop class AddTimestamps < RuboCop::Cop::Cop include MigrationHelpers - MSG = 'Do not use `add_timestamps`, use `add_timestamps_with_timezone` instead'.freeze + MSG = 'Do not use `add_timestamps`, use `add_timestamps_with_timezone` instead' # Check methods. def on_send(node) diff --git a/rubocop/cop/migration/datetime.rb b/rubocop/cop/migration/datetime.rb index 51e0c3e5a22..c605c8e1b6e 100644 --- a/rubocop/cop/migration/datetime.rb +++ b/rubocop/cop/migration/datetime.rb @@ -9,7 +9,7 @@ module RuboCop class Datetime < RuboCop::Cop::Cop include MigrationHelpers - MSG = 'Do not use the `%s` data type, use `datetime_with_timezone` instead'.freeze + MSG = 'Do not use the `%s` data type, use `datetime_with_timezone` instead' # Check methods in table creation. def on_def(node) diff --git a/rubocop/cop/migration/hash_index.rb b/rubocop/cop/migration/hash_index.rb index dba202ef0e3..8becef891af 100644 --- a/rubocop/cop/migration/hash_index.rb +++ b/rubocop/cop/migration/hash_index.rb @@ -11,7 +11,7 @@ module RuboCop include MigrationHelpers MSG = 'hash indexes should be avoided at all costs since they are not ' \ - 'recorded in the PostgreSQL WAL, you should use a btree index instead'.freeze + 'recorded in the PostgreSQL WAL, you should use a btree index instead' NAMES = Set.new([:add_index, :index, :add_concurrent_index]).freeze diff --git a/rubocop/cop/migration/prevent_strings.rb b/rubocop/cop/migration/prevent_strings.rb index bfeabd2c78d..57e29bf74ae 100644 --- a/rubocop/cop/migration/prevent_strings.rb +++ b/rubocop/cop/migration/prevent_strings.rb @@ -11,7 +11,7 @@ module RuboCop MSG = 'Do not use the `string` data type, use `text` instead. ' \ 'Updating limits on strings requires downtime. This can be avoided ' \ - 'by using `text` and adding a limit with `add_text_limit`'.freeze + 'by using `text` and adding a limit with `add_text_limit`' def_node_matcher :reverting?, <<~PATTERN (def :down ...) diff --git a/rubocop/cop/migration/remove_column.rb b/rubocop/cop/migration/remove_column.rb index f63df71467c..6a171ac948f 100644 --- a/rubocop/cop/migration/remove_column.rb +++ b/rubocop/cop/migration/remove_column.rb @@ -10,7 +10,7 @@ module RuboCop class RemoveColumn < RuboCop::Cop::Cop include MigrationHelpers - MSG = '`remove_column` must only be used in post-deployment migrations'.freeze + MSG = '`remove_column` must only be used in post-deployment migrations' def on_def(node) def_method = node.children[0] diff --git a/rubocop/cop/migration/remove_concurrent_index.rb b/rubocop/cop/migration/remove_concurrent_index.rb index 8c2c6fb157e..30dd59d97bc 100644 --- a/rubocop/cop/migration/remove_concurrent_index.rb +++ b/rubocop/cop/migration/remove_concurrent_index.rb @@ -11,7 +11,7 @@ module RuboCop include MigrationHelpers MSG = '`remove_concurrent_index` is not reversible so you must manually define ' \ - 'the `up` and `down` methods in your migration class, using `add_concurrent_index` in `down`'.freeze + 'the `up` and `down` methods in your migration class, using `add_concurrent_index` in `down`' def on_send(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/remove_index.rb b/rubocop/cop/migration/remove_index.rb index 15c2f37b4b0..ca5d4af1520 100644 --- a/rubocop/cop/migration/remove_index.rb +++ b/rubocop/cop/migration/remove_index.rb @@ -9,7 +9,7 @@ module RuboCop class RemoveIndex < RuboCop::Cop::Cop include MigrationHelpers - MSG = '`remove_index` requires downtime, use `remove_concurrent_index` instead'.freeze + MSG = '`remove_index` requires downtime, use `remove_concurrent_index` instead' def on_def(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/safer_boolean_column.rb b/rubocop/cop/migration/safer_boolean_column.rb index 06bb24707bd..1d780d96afa 100644 --- a/rubocop/cop/migration/safer_boolean_column.rb +++ b/rubocop/cop/migration/safer_boolean_column.rb @@ -21,9 +21,9 @@ module RuboCop class SaferBooleanColumn < RuboCop::Cop::Cop include MigrationHelpers - DEFAULT_OFFENSE = 'Boolean columns on the `%s` table should have a default. You may wish to use `add_column_with_default`.'.freeze - NULL_OFFENSE = 'Boolean columns on the `%s` table should disallow nulls.'.freeze - DEFAULT_AND_NULL_OFFENSE = 'Boolean columns on the `%s` table should have a default and should disallow nulls. You may wish to use `add_column_with_default`.'.freeze + DEFAULT_OFFENSE = 'Boolean columns on the `%s` table should have a default. You may wish to use `add_column_with_default`.' + NULL_OFFENSE = 'Boolean columns on the `%s` table should disallow nulls.' + DEFAULT_AND_NULL_OFFENSE = 'Boolean columns on the `%s` table should have a default and should disallow nulls. You may wish to use `add_column_with_default`.' def_node_matcher :add_column?, <<~PATTERN (send nil? :add_column $...) diff --git a/rubocop/cop/migration/timestamps.rb b/rubocop/cop/migration/timestamps.rb index 5584d49ee8c..44baf17d968 100644 --- a/rubocop/cop/migration/timestamps.rb +++ b/rubocop/cop/migration/timestamps.rb @@ -9,7 +9,7 @@ module RuboCop class Timestamps < RuboCop::Cop::Cop include MigrationHelpers - MSG = 'Do not use `timestamps`, use `timestamps_with_timezone` instead'.freeze + MSG = 'Do not use `timestamps`, use `timestamps_with_timezone` instead' # Check methods in table creation. def on_def(node) diff --git a/rubocop/cop/migration/update_column_in_batches.rb b/rubocop/cop/migration/update_column_in_batches.rb index d23e0d28380..e23042e1b9f 100644 --- a/rubocop/cop/migration/update_column_in_batches.rb +++ b/rubocop/cop/migration/update_column_in_batches.rb @@ -11,7 +11,7 @@ module RuboCop include MigrationHelpers MSG = 'Migration running `update_column_in_batches` must have a spec file at' \ - ' `%s`.'.freeze + ' `%s`.' def on_send(node) return unless in_migration?(node) diff --git a/rubocop/cop/migration/with_lock_retries_disallowed_method.rb b/rubocop/cop/migration/with_lock_retries_disallowed_method.rb index f423bde8343..cb36e7413ab 100644 --- a/rubocop/cop/migration/with_lock_retries_disallowed_method.rb +++ b/rubocop/cop/migration/with_lock_retries_disallowed_method.rb @@ -27,6 +27,7 @@ module RuboCop foreign_key_exists? index_exists? column_exists? + create_trigger_to_sync_tables ].sort.freeze MSG = "The method is not allowed to be called within the `with_lock_retries` block, the only allowed methods are: #{ALLOWED_MIGRATION_METHODS.join(', ')}" diff --git a/rubocop/cop/migration/with_lock_retries_with_change.rb b/rubocop/cop/migration/with_lock_retries_with_change.rb index 36fc1f92833..9d11edcb6a1 100644 --- a/rubocop/cop/migration/with_lock_retries_with_change.rb +++ b/rubocop/cop/migration/with_lock_retries_with_change.rb @@ -10,7 +10,7 @@ module RuboCop include MigrationHelpers MSG = '`with_lock_retries` cannot be used within `change` so you must manually define ' \ - 'the `up` and `down` methods in your migration class and use `with_lock_retries` in both methods'.freeze + 'the `up` and `down` methods in your migration class and use `with_lock_retries` in both methods' def on_send(node) return unless in_migration?(node) |