Commit 72441593 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch '338067-ci-builds-cleanup-bigint-conversion' into 'master'

Cleanup bigint conversion for ci_builds

See merge request gitlab-org/gitlab!70351
parents 7b8b9276 176992aa
......@@ -64,8 +64,8 @@ module Ci
delegate :gitlab_deploy_token, to: :project
delegate :trigger_short_token, to: :trigger_request, allow_nil: true
ignore_columns :id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22'
ignore_columns :stage_id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22'
ignore_columns :id_convert_to_bigint, remove_with: '14.5', remove_after: '2021-10-22'
ignore_columns :stage_id_convert_to_bigint, remove_with: '14.5', remove_after: '2021-10-22'
##
# Since Gitlab 11.5, deployments records started being created right after
......
# frozen_string_literal: true
class CleanupBigintConversionForCiBuilds < Gitlab::Database::Migration[1.0]
enable_lock_retries!
TABLE = :ci_builds
COLUMNS = [:id, :stage_id]
def up
cleanup_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
restore_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
end
ecb73d9a0be0cf04a8b405f1225d1a5de2fcdbb4c277fd5549f72a7a21596cdc
\ No newline at end of file
......@@ -77,16 +77,6 @@ RETURN NULL;
END
$$;
CREATE FUNCTION trigger_3f6129be01d2() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."id_convert_to_bigint" := NEW."id";
NEW."stage_id_convert_to_bigint" := NEW."stage_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_542d6c2ad72e() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -11337,7 +11327,6 @@ CREATE TABLE ci_build_trace_metadata (
);
CREATE TABLE ci_builds (
id_convert_to_bigint integer DEFAULT 0 NOT NULL,
status character varying,
finished_at timestamp without time zone,
trace text,
......@@ -11372,7 +11361,6 @@ CREATE TABLE ci_builds (
coverage_regex character varying,
auto_canceled_by_id integer,
retried boolean,
stage_id_convert_to_bigint integer,
protected boolean,
failure_reason integer,
scheduled_at timestamp with time zone,
......@@ -27366,8 +27354,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_3f6129be01d2 BEFORE INSERT OR UPDATE ON ci_builds FOR EACH ROW EXECUTE FUNCTION trigger_3f6129be01d2();
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();
# frozen_string_literal: true
require 'spec_helper'
require_migration!('cleanup_bigint_conversion_for_ci_builds')
RSpec.describe CleanupBigintConversionForCiBuilds do
let(:ci_builds) { table(:ci_builds) }
it 'correctly migrates up and down' do
reversible_migration do |migration|
migration.before -> {
expect(ci_builds.column_names).to include('id_convert_to_bigint')
expect(ci_builds.column_names).to include('stage_id_convert_to_bigint')
}
migration.after -> {
ci_builds.reset_column_information
expect(ci_builds.column_names).not_to include('id_convert_to_bigint')
expect(ci_builds.column_names).not_to include('stage_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