Commit 71721e01 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch '338070-ci-builds-metadata-cleanup-bigint-conversion' into 'master'

Cleanup bigint conversion for ci_builds_metadata

See merge request gitlab-org/gitlab!69712
parents 752317b4 fbf66ae9
......@@ -37,8 +37,8 @@ module Ci
job_timeout_source: 4
}
ignore_column :build_id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22'
ignore_columns :id_convert_to_bigint, remove_with: '14.3', remove_after: '2021-09-22'
ignore_column :build_id_convert_to_bigint, remove_with: '14.5', remove_after: '2021-10-22'
ignore_columns :id_convert_to_bigint, remove_with: '14.5', remove_after: '2021-10-22'
def update_timeout_state
timeout = timeout_with_highest_precedence
......
# frozen_string_literal: true
class CleanupBigintConversionForCiBuildsMetadata < Gitlab::Database::Migration[1.0]
enable_lock_retries!
TABLE = :ci_builds_metadata
def up
cleanup_conversion_of_integer_to_bigint(TABLE, :id)
cleanup_conversion_of_integer_to_bigint(TABLE, :build_id)
end
def down
restore_conversion_of_integer_to_bigint(TABLE, :build_id)
restore_conversion_of_integer_to_bigint(TABLE, :id)
end
end
1a449d347248cacae48d10340c5682abe6de57d2991712f4e0a39c921892e0c5
\ No newline at end of file
......@@ -77,24 +77,6 @@ RETURN NULL;
END
$$;
CREATE FUNCTION trigger_542d6c2ad72e() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."id_convert_to_bigint" := NEW."id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_8487d4de3e7b() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."build_id_convert_to_bigint" := NEW."build_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_91dc388a5fe6() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -11385,8 +11367,6 @@ CREATE SEQUENCE ci_builds_id_seq
ALTER SEQUENCE ci_builds_id_seq OWNED BY ci_builds.id;
CREATE TABLE ci_builds_metadata (
id_convert_to_bigint integer DEFAULT 0 NOT NULL,
build_id_convert_to_bigint integer DEFAULT 0 NOT NULL,
project_id integer NOT NULL,
timeout integer,
timeout_source integer DEFAULT 1 NOT NULL,
......@@ -27357,10 +27337,6 @@ ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_p
ALTER INDEX product_analytics_events_experimental_pkey ATTACH PARTITION gitlab_partitions_static.product_analytics_events_experimental_63_pkey;
CREATE TRIGGER trigger_542d6c2ad72e BEFORE INSERT OR UPDATE ON ci_builds_metadata FOR EACH ROW EXECUTE FUNCTION trigger_542d6c2ad72e();
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();
CREATE TRIGGER trigger_aebe8b822ad3 BEFORE INSERT OR UPDATE ON taggings FOR EACH ROW EXECUTE FUNCTION trigger_aebe8b822ad3();
# frozen_string_literal: true
require 'spec_helper'
require_migration!('cleanup_bigint_conversion_for_ci_builds_metadata')
RSpec.describe CleanupBigintConversionForCiBuildsMetadata do
let(:ci_builds_metadata) { table(:ci_builds_metadata) }
it 'correctly migrates up and down' do
reversible_migration do |migration|
migration.before -> {
expect(ci_builds_metadata.column_names).to include('id_convert_to_bigint')
expect(ci_builds_metadata.column_names).to include('build_id_convert_to_bigint')
}
migration.after -> {
ci_builds_metadata.reset_column_information
expect(ci_builds_metadata.column_names).not_to include('id_convert_to_bigint')
expect(ci_builds_metadata.column_names).not_to include('build_id_convert_to_bigint')
}
end
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