Commit 07f34bb1 authored by dfrazao-gitlab's avatar dfrazao-gitlab Committed by Krasimir Angelov

Address the PK Overflow risk for the ci_sources_pipelines - Step 3

- Ignore source_job_id_convert_to_bigint column
- Remove trigger_8485e97c00e3 trigger

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/338059

Changelog: added
parent a998bacb
......@@ -4,6 +4,9 @@ module Ci
module Sources
class Pipeline < Ci::ApplicationRecord
include Ci::NamespacedModelName
include IgnorableColumns
ignore_columns 'source_job_id_convert_to_bigint', remove_with: '14.5', remove_after: '2021-11-22'
self.table_name = "ci_sources_pipelines"
......
# frozen_string_literal: true
class DropTemporaryTriggerForCiSourcesPipelines < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
TABLE = 'ci_sources_pipelines'
TEMPORARY_COLUMN = 'source_job_id_convert_to_bigint'
MAIN_COLUMN = 'source_job_id'
TRIGGER = 'trigger_8485e97c00e3'
# rubocop:disable Migration/WithLockRetriesDisallowedMethod
def up
check_trigger_permissions!(TABLE)
with_lock_retries do
remove_rename_triggers(TABLE, TRIGGER)
end
end
def down
check_trigger_permissions!(TABLE)
with_lock_retries do
install_rename_triggers(TABLE, MAIN_COLUMN, TEMPORARY_COLUMN, trigger_name: TRIGGER)
end
end
# rubocop:enable Migration/WithLockRetriesDisallowedMethod
end
36572ad3a4a8a7511512ff45e2a68252950ce852af1b5a28c6b4e4491f97be07
\ No newline at end of file
......@@ -107,15 +107,6 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_8485e97c00e3() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."source_job_id_convert_to_bigint" := NEW."source_job_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_8487d4de3e7b() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -27327,8 +27318,6 @@ CREATE TRIGGER trigger_542d6c2ad72e BEFORE INSERT OR UPDATE ON ci_builds_metadat
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();
CREATE TRIGGER trigger_8487d4de3e7b BEFORE INSERT OR UPDATE ON ci_builds_metadata FOR EACH ROW EXECUTE FUNCTION trigger_8487d4de3e7b();
CREATE TRIGGER trigger_91dc388a5fe6 BEFORE INSERT OR UPDATE ON dep_ci_build_trace_sections FOR EACH ROW EXECUTE FUNCTION trigger_91dc388a5fe6();
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