Commit cf9a7a85 authored by Krasimir Angelov's avatar Krasimir Angelov

Merge branch...

Merge branch '338059-address-the-primary-key-overflow-risk-for-the-ci_sources_pipelines-table-step-3-drop' into 'master'

Resolve "Address the Primary Key Overflow risk for the ci_sources_pipelines table - Step 3: Drop temporary columns and triggers"

See merge request gitlab-org/gitlab!69281
parents a5135144 07f34bb1
......@@ -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