Commit 385a7697 authored by Krasimir Angelov's avatar Krasimir Angelov Committed by Andreas Brandl

Initialize conversion of ci_build_trace_chunks.build_id to bigint

See https://gitlab.com/gitlab-org/gitlab/-/issues/328442.

Changelog: other
parent 065153e6
...@@ -8,6 +8,9 @@ module Ci ...@@ -8,6 +8,9 @@ module Ci
include ::Checksummable include ::Checksummable
include ::Gitlab::ExclusiveLeaseHelpers include ::Gitlab::ExclusiveLeaseHelpers
include ::Gitlab::OptimisticLocking include ::Gitlab::OptimisticLocking
include IgnorableColumns
ignore_columns :build_id_convert_to_bigint, remove_with: '14.1', remove_after: '2021-07-22'
belongs_to :build, class_name: "Ci::Build", foreign_key: :build_id belongs_to :build, class_name: "Ci::Build", foreign_key: :build_id
......
---
title: Initialize conversion of ci_build_trace_chunks.build_id to bigint
merge_request: 60346
author:
type: other
# frozen_string_literal: true
class InitializeConversionOfCiBuildTraceChunksToBigint < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :ci_build_trace_chunks
COLUMNS = %i(build_id)
def up
initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
end
# frozen_string_literal: true
class BackfillCiBuildTraceChunksForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :ci_build_trace_chunks
COLUMNS = %i(build_id)
def up
return unless should_run?
backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
return unless should_run?
revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
private
def should_run?
Gitlab.dev_or_test_env? || Gitlab.com?
end
end
bdeb78403607d45d5eb779623d0e2aa1acf026f6aced6f1134824a35dfec7e74
\ No newline at end of file
3cd56794ac903d9598863215a34eda62c3dc96bed78bed5b8a99fc522e319b35
\ No newline at end of file
...@@ -162,6 +162,15 @@ BEGIN ...@@ -162,6 +162,15 @@ BEGIN
END; END;
$$; $$;
CREATE FUNCTION trigger_cf2f9e35f002() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."build_id_convert_to_bigint" := NEW."build_id";
RETURN NEW;
END;
$$;
CREATE TABLE audit_events ( CREATE TABLE audit_events (
id bigint NOT NULL, id bigint NOT NULL,
author_id integer NOT NULL, author_id integer NOT NULL,
...@@ -10370,7 +10379,8 @@ CREATE TABLE ci_build_trace_chunks ( ...@@ -10370,7 +10379,8 @@ CREATE TABLE ci_build_trace_chunks (
data_store integer NOT NULL, data_store integer NOT NULL,
raw_data bytea, raw_data bytea,
checksum bytea, checksum bytea,
lock_version integer DEFAULT 0 NOT NULL lock_version integer DEFAULT 0 NOT NULL,
build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL
); );
CREATE SEQUENCE ci_build_trace_chunks_id_seq CREATE SEQUENCE ci_build_trace_chunks_id_seq
...@@ -24817,6 +24827,8 @@ CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipeli ...@@ -24817,6 +24827,8 @@ CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipeli
CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts FOR EACH ROW EXECUTE PROCEDURE trigger_be1804f21693(); CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts FOR EACH ROW EXECUTE PROCEDURE trigger_be1804f21693();
CREATE TRIGGER trigger_cf2f9e35f002 BEFORE INSERT OR UPDATE ON ci_build_trace_chunks FOR EACH ROW EXECUTE PROCEDURE trigger_cf2f9e35f002();
CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker(); CREATE TRIGGER trigger_has_external_issue_tracker_on_delete AFTER DELETE ON services FOR EACH ROW WHEN ((((old.category)::text = 'issue_tracker'::text) AND (old.active = true) AND (old.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker();
CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker(); CREATE TRIGGER trigger_has_external_issue_tracker_on_insert AFTER INSERT ON services FOR EACH ROW WHEN ((((new.category)::text = 'issue_tracker'::text) AND (new.active = true) AND (new.project_id IS NOT NULL))) EXECUTE PROCEDURE set_has_external_issue_tracker();
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