Commit 14d23005 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '329536-taggings-bigint' into 'master'

Prepare taggings table for bigint conversion

See merge request gitlab-org/gitlab!62205
parents 10139b88 4bcbf379
...@@ -9,3 +9,7 @@ ActsAsTaggableOn.tags_counter = false ...@@ -9,3 +9,7 @@ ActsAsTaggableOn.tags_counter = false
# validate that counter cache is disabled # validate that counter cache is disabled
raise "Counter cache is not disabled" if raise "Counter cache is not disabled" if
ActsAsTaggableOn::Tagging.reflections["tag"].options[:counter_cache] ActsAsTaggableOn::Tagging.reflections["tag"].options[:counter_cache]
ActsAsTaggableOn::Tagging.include IgnorableColumns
ActsAsTaggableOn::Tagging.ignore_column :id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22'
ActsAsTaggableOn::Tagging.ignore_column :taggable_id_convert_to_bigint, remove_with: '14.2', remove_after: '2021-08-22'
# frozen_string_literal: true
class InitializeConversionOfTaggingsToBigint < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :taggings
COLUMNS = %i(id taggable_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 BackfillTaggingsForBigintConversion < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
TABLE = :taggings
COLUMNS = %i(id taggable_id)
def up
backfill_conversion_of_integer_to_bigint TABLE, COLUMNS, batch_size: 15000, sub_batch_size: 100
end
def down
revert_backfill_conversion_of_integer_to_bigint TABLE, COLUMNS
end
end
eddbcd18c17f9017a2cdfb6fc0144dcfcb539d3617271722b2918bdbe48c481a
\ No newline at end of file
3ee15db28406522a5fb591395dd3d4a46b10e958339dc60ded3751e23096864d
\ No newline at end of file
...@@ -170,6 +170,16 @@ BEGIN ...@@ -170,6 +170,16 @@ BEGIN
END; END;
$$; $$;
CREATE FUNCTION trigger_aebe8b822ad3() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."id_convert_to_bigint" := NEW."id";
NEW."taggable_id_convert_to_bigint" := NEW."taggable_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_be1804f21693() RETURNS trigger CREATE FUNCTION trigger_be1804f21693() RETURNS trigger
LANGUAGE plpgsql LANGUAGE plpgsql
AS $$ AS $$
...@@ -18218,7 +18228,9 @@ CREATE TABLE taggings ( ...@@ -18218,7 +18228,9 @@ CREATE TABLE taggings (
tagger_id integer, tagger_id integer,
tagger_type character varying, tagger_type character varying,
context character varying, context character varying,
created_at timestamp without time zone created_at timestamp without time zone,
id_convert_to_bigint bigint DEFAULT 0 NOT NULL,
taggable_id_convert_to_bigint bigint
); );
CREATE SEQUENCE taggings_id_seq CREATE SEQUENCE taggings_id_seq
...@@ -25263,6 +25275,8 @@ CREATE TRIGGER trigger_8487d4de3e7b BEFORE INSERT OR UPDATE ON ci_builds_metadat ...@@ -25263,6 +25275,8 @@ CREATE TRIGGER trigger_8487d4de3e7b BEFORE INSERT OR UPDATE ON ci_builds_metadat
CREATE TRIGGER trigger_91dc388a5fe6 BEFORE INSERT OR UPDATE ON ci_build_trace_sections FOR EACH ROW EXECUTE FUNCTION trigger_91dc388a5fe6(); CREATE TRIGGER trigger_91dc388a5fe6 BEFORE INSERT OR UPDATE ON 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();
CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts FOR EACH ROW EXECUTE FUNCTION trigger_be1804f21693(); 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(); 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