Commit 1a993332 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch 'id-fix-rails-6-1-kwargs-deprecations' into 'master'

Fix Ruby 2.7 deprecated kwargs usages

See merge request gitlab-org/gitlab!60773
parents 191f7499 f94af172
...@@ -6,7 +6,7 @@ module ThrottledTouch ...@@ -6,7 +6,7 @@ module ThrottledTouch
# The amount of time to wait before "touch" can update a record again. # The amount of time to wait before "touch" can update a record again.
TOUCH_INTERVAL = 1.minute TOUCH_INTERVAL = 1.minute
def touch(*args) def touch(*args, **kwargs)
super if (Time.zone.now - updated_at) > TOUCH_INTERVAL super if (Time.zone.now - updated_at) > TOUCH_INTERVAL
end end
end end
...@@ -495,7 +495,7 @@ class Note < ApplicationRecord ...@@ -495,7 +495,7 @@ class Note < ApplicationRecord
noteable&.expire_note_etag_cache noteable&.expire_note_etag_cache
end end
def touch(*args) def touch(*args, **kwargs)
# We're not using an explicit transaction here because this would in all # We're not using an explicit transaction here because this would in all
# cases result in all future queries going to the primary, even if no writes # cases result in all future queries going to the primary, even if no writes
# are performed. # are performed.
......
...@@ -4,7 +4,7 @@ module ActiveRecord ...@@ -4,7 +4,7 @@ module ActiveRecord
module Associations module Associations
class Preloader class Preloader
class NullPreloader class NullPreloader
def self.new(klass, owners, reflection, preload_scope) def self.new(*args, **kwargs)
self self
end end
......
...@@ -51,7 +51,7 @@ module Gitlab ...@@ -51,7 +51,7 @@ module Gitlab
allow_null: options[:null] allow_null: options[:null]
) )
else else
add_column(table_name, column_name, :datetime_with_timezone, options) add_column(table_name, column_name, :datetime_with_timezone, **options)
end end
end end
end end
...@@ -143,13 +143,13 @@ module Gitlab ...@@ -143,13 +143,13 @@ module Gitlab
options = options.merge({ algorithm: :concurrently }) options = options.merge({ algorithm: :concurrently })
if index_exists?(table_name, column_name, options) if index_exists?(table_name, column_name, **options)
Gitlab::AppLogger.warn "Index not created because it already exists (this may be due to an aborted migration or similar): table_name: #{table_name}, column_name: #{column_name}" Gitlab::AppLogger.warn "Index not created because it already exists (this may be due to an aborted migration or similar): table_name: #{table_name}, column_name: #{column_name}"
return return
end end
disable_statement_timeout do disable_statement_timeout do
add_index(table_name, column_name, options) add_index(table_name, column_name, **options)
end end
end end
...@@ -169,13 +169,13 @@ module Gitlab ...@@ -169,13 +169,13 @@ module Gitlab
options = options.merge({ algorithm: :concurrently }) options = options.merge({ algorithm: :concurrently })
unless index_exists?(table_name, column_name, options) unless index_exists?(table_name, column_name, **options)
Gitlab::AppLogger.warn "Index not removed because it does not exist (this may be due to an aborted migration or similar): table_name: #{table_name}, column_name: #{column_name}" Gitlab::AppLogger.warn "Index not removed because it does not exist (this may be due to an aborted migration or similar): table_name: #{table_name}, column_name: #{column_name}"
return return
end end
disable_statement_timeout do disable_statement_timeout do
remove_index(table_name, options.merge({ column: column_name })) remove_index(table_name, **options.merge({ column: column_name }))
end end
end end
...@@ -205,7 +205,7 @@ module Gitlab ...@@ -205,7 +205,7 @@ module Gitlab
end end
disable_statement_timeout do disable_statement_timeout do
remove_index(table_name, options.merge({ name: index_name })) remove_index(table_name, **options.merge({ name: index_name }))
end end
end end
...@@ -1194,8 +1194,8 @@ module Gitlab ...@@ -1194,8 +1194,8 @@ module Gitlab
end end
end end
def remove_foreign_key_without_error(*args) def remove_foreign_key_without_error(*args, **kwargs)
remove_foreign_key(*args) remove_foreign_key(*args, **kwargs)
rescue ArgumentError rescue ArgumentError
end end
......
...@@ -40,7 +40,7 @@ module Gitlab ...@@ -40,7 +40,7 @@ module Gitlab
end end
with_lock_retries do with_lock_retries do
add_index(table_name, column_names, options) add_index(table_name, column_names, **options)
end end
end end
......
...@@ -64,7 +64,7 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::IndexHelpers do ...@@ -64,7 +64,7 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::IndexHelpers do
def expect_add_concurrent_index_and_call_original(table, column, index) def expect_add_concurrent_index_and_call_original(table, column, index)
expect(migration).to receive(:add_concurrent_index).ordered.with(table, column, name: index) expect(migration).to receive(:add_concurrent_index).ordered.with(table, column, name: index)
.and_wrap_original { |_, table, column, options| connection.add_index(table, column, options) } .and_wrap_original { |_, table, column, options| connection.add_index(table, column, **options) }
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment