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
# The amount of time to wait before "touch" can update a record again.
TOUCH_INTERVAL = 1.minute
def touch(*args)
def touch(*args, **kwargs)
super if (Time.zone.now - updated_at) > TOUCH_INTERVAL
end
end
......@@ -495,7 +495,7 @@ class Note < ApplicationRecord
noteable&.expire_note_etag_cache
end
def touch(*args)
def touch(*args, **kwargs)
# 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
# are performed.
......
......@@ -4,7 +4,7 @@ module ActiveRecord
module Associations
class Preloader
class NullPreloader
def self.new(klass, owners, reflection, preload_scope)
def self.new(*args, **kwargs)
self
end
......
......@@ -51,7 +51,7 @@ module Gitlab
allow_null: options[:null]
)
else
add_column(table_name, column_name, :datetime_with_timezone, options)
add_column(table_name, column_name, :datetime_with_timezone, **options)
end
end
end
......@@ -143,13 +143,13 @@ module Gitlab
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}"
return
end
disable_statement_timeout do
add_index(table_name, column_name, options)
add_index(table_name, column_name, **options)
end
end
......@@ -169,13 +169,13 @@ module Gitlab
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}"
return
end
disable_statement_timeout do
remove_index(table_name, options.merge({ column: column_name }))
remove_index(table_name, **options.merge({ column: column_name }))
end
end
......@@ -205,7 +205,7 @@ module Gitlab
end
disable_statement_timeout do
remove_index(table_name, options.merge({ name: index_name }))
remove_index(table_name, **options.merge({ name: index_name }))
end
end
......@@ -1194,8 +1194,8 @@ module Gitlab
end
end
def remove_foreign_key_without_error(*args)
remove_foreign_key(*args)
def remove_foreign_key_without_error(*args, **kwargs)
remove_foreign_key(*args, **kwargs)
rescue ArgumentError
end
......
......@@ -40,7 +40,7 @@ module Gitlab
end
with_lock_retries do
add_index(table_name, column_names, options)
add_index(table_name, column_names, **options)
end
end
......
......@@ -64,7 +64,7 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::IndexHelpers do
def expect_add_concurrent_index_and_call_original(table, column, 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
......
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