Commit 8ed2b60a authored by Nikola Milojevic's avatar Nikola Milojevic

Merge branch...

Merge branch '338068-address-the-primary-key-overflow-risk-for-the-ci_job_artifacts-table-step-3-drop-temporary' into 'master'

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

See merge request gitlab-org/gitlab!68770
parents 1819a21d e206b514
......@@ -10,6 +10,9 @@ module Ci
include Artifactable
include FileStoreMounter
include EachBatch
include IgnorableColumns
ignore_columns %i[id_convert_to_bigint job_id_convert_to_bigint], remove_with: '14.5', remove_after: '2021-11-22'
TEST_REPORT_FILE_TYPES = %w[junit].freeze
COVERAGE_REPORT_FILE_TYPES = %w[cobertura].freeze
......
# frozen_string_literal: true
class DropTemporaryTriggerForCiJobArtifacts < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
TABLE = 'ci_job_artifacts'
TEMPORARY_COLUMNS = %w(id_convert_to_bigint job_id_convert_to_bigint)
MAIN_COLUMNS = %w(id job_id)
TRIGGER = 'trigger_be1804f21693'
# 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_COLUMNS, TEMPORARY_COLUMNS, trigger_name: TRIGGER)
end
end
# rubocop:enable Migration/WithLockRetriesDisallowedMethod
end
874ed71410406d10ade9c834d1374b039effd9e88514d327d04275e11e837ffb
\ No newline at end of file
......@@ -153,16 +153,6 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_be1804f21693() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."id_convert_to_bigint" := NEW."id";
NEW."job_id_convert_to_bigint" := NEW."job_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_cf2f9e35f002() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -27351,8 +27341,6 @@ CREATE TRIGGER trigger_91dc388a5fe6 BEFORE INSERT OR UPDATE ON dep_ci_build_trac
CREATE TRIGGER trigger_aebe8b822ad3 BEFORE INSERT OR UPDATE ON taggings FOR EACH ROW EXECUTE FUNCTION trigger_aebe8b822ad3();
CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts FOR EACH ROW EXECUTE FUNCTION trigger_be1804f21693();
CREATE TRIGGER trigger_cf2f9e35f002 BEFORE INSERT OR UPDATE ON ci_build_trace_chunks FOR EACH ROW EXECUTE FUNCTION trigger_cf2f9e35f002();
CREATE TRIGGER trigger_f1ca8ec18d78 BEFORE INSERT OR UPDATE ON geo_job_artifact_deleted_events FOR EACH ROW EXECUTE FUNCTION trigger_f1ca8ec18d78();
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