Commit 12af7f89 authored by Andreas Brandl's avatar Andreas Brandl

Prepare ci_build_trace_sections for int8 migration

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/328432

Changelog: other
parent e6dd3f40
......@@ -4,11 +4,14 @@ module Ci
class BuildTraceSection < ApplicationRecord
extend SuppressCompositePrimaryKeyWarning
extend Gitlab::Ci::Model
include IgnorableColumns
belongs_to :build, class_name: 'Ci::Build'
belongs_to :project
belongs_to :section_name, class_name: 'Ci::BuildTraceSectionName'
validates :section_name, :build, :project, presence: true, allow_blank: false
ignore_column :build_id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22'
end
end
---
title: Prepare ci_build_trace_sections for int8 migration
merge_request: 62098
author:
type: other
# frozen_string_literal: true
class InitializeConversionOfCiBuildTraceSectionsToBigint < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :ci_build_trace_sections
COLUMN = :build_id
def up
initialize_conversion_of_integer_to_bigint(TABLE, COLUMN, primary_key: COLUMN)
end
def down
revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
end
end
# frozen_string_literal: true
class BackfillCiBuildTraceSectionsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :ci_build_trace_sections
COLUMN = :build_id
def up
backfill_conversion_of_integer_to_bigint TABLE, COLUMN, batch_size: 15000, sub_batch_size: 100, primary_key: COLUMN
end
def down
revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMN, primary_key: COLUMN
end
end
feee3b817b18ab913071c29b5c6283d91268dc62b31ee2441c1cb116bf0d77c9
\ No newline at end of file
00ac4ff6896f65d7ad7d259d7e5a39efcbf73b189f7c2c5a472f50aa45663235
\ No newline at end of file
......@@ -152,6 +152,15 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_91dc388a5fe6() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."build_id_convert_to_bigint" := NEW."build_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_be1804f21693() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -10499,7 +10508,8 @@ CREATE TABLE ci_build_trace_sections (
byte_start bigint NOT NULL,
byte_end bigint NOT NULL,
build_id integer NOT NULL,
section_name_id integer NOT NULL
section_name_id integer NOT NULL,
build_id_convert_to_bigint bigint DEFAULT 0 NOT NULL
);
CREATE TABLE ci_builds (
......@@ -25238,6 +25248,8 @@ CREATE TRIGGER trigger_69523443cc10 BEFORE INSERT OR UPDATE ON events FOR EACH R
CREATE TRIGGER trigger_8485e97c00e3 BEFORE INSERT OR UPDATE ON ci_sources_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_8485e97c00e3();
CREATE TRIGGER trigger_91dc388a5fe6 BEFORE INSERT OR UPDATE ON ci_build_trace_sections FOR EACH ROW EXECUTE FUNCTION trigger_91dc388a5fe6();
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();
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