Skip to content
Snippets Groups Projects
Commit 1e5d15b5 authored by Simon Tomlinson's avatar Simon Tomlinson :three:
Browse files

Merge branch '389306/vulnerability_user_mentions/initialize' into 'master'

Initialize conversion of vulnerability_user_mentions.note_id to bigint

See merge request !111259



Merged-by: Simon Tomlinson's avatarSimon Tomlinson <stomlinson@gitlab.com>
Approved-by: Terri Chu's avatarTerri Chu <tchu@gitlab.com>
Approved-by: Simon Tomlinson's avatarSimon Tomlinson <stomlinson@gitlab.com>
Co-authored-by: default avatarKrasimir Angelov <kangelov@gitlab.com>
parents 718172c0 ddd46d7c
No related branches found
No related tags found
1 merge request!111259Initialize conversion of vulnerability_user_mentions.note_id to bigint
Pipeline #780302116 passed
# frozen_string_literal: true
class InitializeConversionOfVulnerabilityUserMentionsNoteIdToBigint < Gitlab::Database::Migration[2.1]
TABLE = :vulnerability_user_mentions
COLUMNS = %i[note_id]
enable_lock_retries!
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 BackfillVulnerabilityUserMentionsNoteIdForBigintConversion < Gitlab::Database::Migration[2.1]
TABLE = :vulnerability_user_mentions
COLUMNS = %i[note_id]
restrict_gitlab_migration gitlab_schema: :gitlab_main
def up
backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
def down
revert_backfill_conversion_of_integer_to_bigint(TABLE, COLUMNS)
end
end
e9b82380fc23c85bf9f4dc6595a4eb59eedfe696f5dc256141e8b4a7ebaa6ee3
\ No newline at end of file
d3789404b6ecb38eabfa75c41db936bceb2aa219c770764d30caca6d94358ba4
\ No newline at end of file
......@@ -225,6 +225,15 @@ RETURN NULL;
END
$$;
 
CREATE FUNCTION trigger_0e214b8a14f2() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."note_id_convert_to_bigint" := NEW."note_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_17c3a95ee58a() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -23814,7 +23823,8 @@ CREATE TABLE vulnerability_user_mentions (
note_id integer,
mentioned_users_ids integer[],
mentioned_projects_ids integer[],
mentioned_groups_ids integer[]
mentioned_groups_ids integer[],
note_id_convert_to_bigint bigint
);
 
CREATE SEQUENCE vulnerability_user_mentions_id_seq
......@@ -33715,6 +33725,8 @@ CREATE TRIGGER nullify_merge_request_metrics_build_data_on_update BEFORE UPDATE
 
CREATE TRIGGER projects_loose_fk_trigger AFTER DELETE ON projects REFERENCING OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION insert_into_loose_foreign_keys_deleted_records();
 
CREATE TRIGGER trigger_0e214b8a14f2 BEFORE INSERT OR UPDATE ON vulnerability_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_0e214b8a14f2();
CREATE TRIGGER trigger_17c3a95ee58a BEFORE INSERT OR UPDATE ON commit_user_mentions FOR EACH ROW EXECUTE FUNCTION trigger_17c3a95ee58a();
 
CREATE TRIGGER trigger_1a857e8db6cd BEFORE INSERT OR UPDATE ON vulnerability_occurrences FOR EACH ROW EXECUTE FUNCTION trigger_1a857e8db6cd();
# frozen_string_literal: true
class VulnerabilityUserMention < UserMention
include IgnorableColumns
ignore_column :note_id_convert_to_bigint, remove_with: '16.0', remove_after: '2023-05-22'
belongs_to :vulnerability
belongs_to :note
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment