Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
fa885192b7
commit
aaa1062165
5 changed files with 44 additions and 12 deletions
|
@ -9,6 +9,9 @@ class Event < ApplicationRecord
|
|||
include Gitlab::Utils::StrongMemoize
|
||||
include UsageStatistics
|
||||
include ShaAttribute
|
||||
include IgnorableColumns
|
||||
|
||||
ignore_columns :id_convert_to_bigint, remove_with: '14.5', remove_after: '2021-10-22'
|
||||
|
||||
default_scope { reorder(nil) } # rubocop:disable Cop/DefaultScope
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ module Issuable
|
|||
update_class.new(
|
||||
**update_class.constructor_container_arg(issuable.issuing_parent),
|
||||
current_user: current_user,
|
||||
params: params.dup
|
||||
params: dup_params
|
||||
).execute(issuable)
|
||||
end
|
||||
|
||||
|
@ -82,6 +82,19 @@ module Issuable
|
|||
.includes_for_bulk_update
|
||||
end
|
||||
|
||||
# Duplicates params and its top-level values
|
||||
# We cannot use deep_dup because ActiveRecord objects will result
|
||||
# to new records with no id assigned
|
||||
def dup_params
|
||||
dup = HashWithIndifferentAccess.new
|
||||
|
||||
params.each do |key, value|
|
||||
dup[key] = value.is_a?(ActiveRecord::Base) ? value : value.dup
|
||||
end
|
||||
|
||||
dup
|
||||
end
|
||||
|
||||
def response_success(message: nil, payload: nil)
|
||||
ServiceResponse.success(message: message, payload: payload)
|
||||
end
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class EventsBigintConversionRemoveTriggers < Gitlab::Database::Migration[1.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
TABLE_NAME = :events
|
||||
TRIGGER_NAME = :trigger_69523443cc10
|
||||
|
||||
# rubocop:disable Migration/WithLockRetriesDisallowedMethod
|
||||
def up
|
||||
check_trigger_permissions!(TABLE_NAME)
|
||||
|
||||
with_lock_retries do
|
||||
remove_rename_triggers(TABLE_NAME, TRIGGER_NAME)
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
check_trigger_permissions!(TABLE_NAME)
|
||||
|
||||
with_lock_retries do
|
||||
install_rename_triggers(TABLE_NAME, :id, :id_convert_to_bigint, trigger_name: TRIGGER_NAME)
|
||||
end
|
||||
end
|
||||
# rubocop:enable Migration/WithLockRetriesDisallowedMethod
|
||||
end
|
1
db/schema_migrations/20210901044237
Normal file
1
db/schema_migrations/20210901044237
Normal file
|
@ -0,0 +1 @@
|
|||
0d8caaa078914ed2bd43b383ee2efe50093947d65862c2f4dd8dc960cad0a43e
|
|
@ -98,15 +98,6 @@ BEGIN
|
|||
END;
|
||||
$$;
|
||||
|
||||
CREATE FUNCTION trigger_69523443cc10() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
BEGIN
|
||||
NEW."id_convert_to_bigint" := NEW."id";
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
|
||||
CREATE FUNCTION trigger_77f5e1d20482() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
|
@ -27333,8 +27324,6 @@ CREATE TRIGGER trigger_51ab7cef8934 BEFORE INSERT OR UPDATE ON ci_builds_runner_
|
|||
|
||||
CREATE TRIGGER trigger_542d6c2ad72e BEFORE INSERT OR UPDATE ON ci_builds_metadata FOR EACH ROW EXECUTE FUNCTION trigger_542d6c2ad72e();
|
||||
|
||||
CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH ROW EXECUTE FUNCTION trigger_69523443cc10();
|
||||
|
||||
CREATE TRIGGER trigger_77f5e1d20482 BEFORE INSERT OR UPDATE ON deployments FOR EACH ROW EXECUTE FUNCTION trigger_77f5e1d20482();
|
||||
|
||||
CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_8485e97c00e3();
|
||||
|
|
Loading…
Reference in a new issue