Skip to content
Snippets Groups Projects
Verified Commit c65891c9 authored by Tianwen Chen's avatar Tianwen Chen :two: Committed by GitLab
Browse files

Initialize bigint conversion for packages_build_infos

This is the first step to convert pipeline_id related to bigint for:
- packages_build_infos.pipeline_id

See https://docs.gitlab.com/ee/development/database/avoiding_downtime_in_migrations.html#initialize-the-conversion-and-start-migrating-existing-data-release-n

Changelog: added
parent 5e353f51
No related branches found
No related tags found
1 merge request!148791Initialize bigint conversion for packages_build_infos
# frozen_string_literal: true
class Packages::PackageFileBuildInfo < ApplicationRecord
include IgnorableColumns
ignore_columns :pipeline_id_convert_to_bigint, remove_with: '17.1', remove_after: '2024-06-14'
belongs_to :package_file, inverse_of: :package_file_build_infos
belongs_to :pipeline, class_name: 'Ci::Pipeline'
end
# frozen_string_literal: true
class InitConversionForPackagesBuildInfosPipelineIdBigint < Gitlab::Database::Migration[2.2]
disable_ddl_transaction!
milestone '16.11'
TABLE = :packages_build_infos
COLUMN = :pipeline_id
def up
initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
end
def down
revert_initialize_conversion_of_integer_to_bigint(TABLE, COLUMN)
end
end
# frozen_string_literal: true
class BackfillPackagesBuildInfosPipelineIdBigint < Gitlab::Database::Migration[2.2]
restrict_gitlab_migration gitlab_schema: :gitlab_main
milestone '16.11'
TABLE = :packages_build_infos
COLUMN = :pipeline_id
def up
backfill_conversion_of_integer_to_bigint(TABLE, COLUMN)
end
def down
revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMN)
end
end
9ddd7201b4704ef1e5689c5b3afe2530fcb1eefb50242a0d701a85d3bf061cb1
\ No newline at end of file
e4200619fb3acacf5f6e23f3ea8dc027f3717a1cc62611c9fb3292957465cf7b
\ No newline at end of file
......@@ -668,6 +668,15 @@ BEGIN
END;
$$;
 
CREATE FUNCTION trigger_388e93f88fdd() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."pipeline_id_convert_to_bigint" := NEW."pipeline_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_b2d852e1e2cb() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -12361,7 +12370,8 @@ ALTER SEQUENCE p_ci_job_annotations_id_seq OWNED BY p_ci_job_annotations.id;
CREATE TABLE packages_build_infos (
id bigint NOT NULL,
package_id integer NOT NULL,
pipeline_id integer
pipeline_id integer,
pipeline_id_convert_to_bigint bigint
);
 
CREATE SEQUENCE packages_build_infos_id_seq
......@@ -29594,6 +29604,8 @@ CREATE TRIGGER trigger_10ee1357e825 BEFORE INSERT OR UPDATE ON p_ci_builds FOR E
 
CREATE TRIGGER trigger_2428b5519042 BEFORE INSERT OR UPDATE ON vulnerability_feedback FOR EACH ROW EXECUTE FUNCTION trigger_2428b5519042();
 
CREATE TRIGGER trigger_388e93f88fdd BEFORE INSERT OR UPDATE ON packages_build_infos FOR EACH ROW EXECUTE FUNCTION trigger_388e93f88fdd();
CREATE TRIGGER trigger_b2d852e1e2cb BEFORE INSERT OR UPDATE ON ci_pipelines FOR EACH ROW EXECUTE FUNCTION trigger_b2d852e1e2cb();
 
CREATE TRIGGER trigger_catalog_resource_sync_event_on_project_update AFTER UPDATE ON projects FOR EACH ROW WHEN ((((old.name)::text IS DISTINCT FROM (new.name)::text) OR (old.description IS DISTINCT FROM new.description) OR (old.visibility_level IS DISTINCT FROM new.visibility_level))) EXECUTE FUNCTION insert_catalog_resource_sync_event();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment