Finalize conversion to bigint for ci_builds_metadata

What does this MR do?

Follow-up to the changes made in !62102 (merged) and !65477 (merged).

Strategy: &4785 (comment 635586664)

Related to #325617 (closed)

Migration up
== 20210708011425 RenameCiBuildsMetadataForeignKey: migrating =================
-- quote_table_name("ci_builds_metadata")
   -> 0.0001s
-- quote_column_name("fk_rails_e20479742e")
   -> 0.0000s
-- quote_column_name("fk_e20479742e")
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\"\nRENAME CONSTRAINT \"fk_rails_e20479742e\" TO \"fk_e20479742e\"\n")
   -> 0.0013s
== 20210708011425 RenameCiBuildsMetadataForeignKey: migrated (0.0078s) ========

== 20210708011426 FinalizeCiBuildsMetadataBigintConversion: migrating =========
-- transaction_open?()
   -> 0.0000s
-- index_exists?("ci_builds_metadata", :id_convert_to_bigint, {:unique=>true, :name=>"index_ci_builds_metadata_on_id_convert_to_bigint", :algorithm=>:concurrently})
   -> 0.0036s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- add_index("ci_builds_metadata", :id_convert_to_bigint, {:unique=>true, :name=>"index_ci_builds_metadata_on_id_convert_to_bigint", :algorithm=>:concurrently})
   -> 0.0029s
-- execute("RESET ALL")
   -> 0.0004s
-- transaction_open?()
   -> 0.0000s
-- index_exists?("ci_builds_metadata", :build_id_convert_to_bigint, {:where=>"has_exposed_artifacts IS TRUE", :name=>"index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts", :algorithm=>:concurrently})
   -> 0.0024s
-- add_index("ci_builds_metadata", :build_id_convert_to_bigint, {:where=>"has_exposed_artifacts IS TRUE", :name=>"index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts", :algorithm=>:concurrently})
   -> 0.0021s
-- indexes("ci_builds_metadata")
   -> 0.0023s
-- current_schema()
   -> 0.0001s
-- execute("CREATE INDEX CONCURRENTLY index_ci_builds_metadata_on_build_id_int8_and_id_int8_and_inter\nON ci_builds_metadata (build_id_convert_to_bigint) INCLUDE (id_convert_to_bigint)\nWHERE interruptible = true\n")
   -> 0.0020s
-- transaction_open?()
   -> 0.0000s
-- index_exists?("ci_builds_metadata", :build_id_convert_to_bigint, {:unique=>true, :name=>"index_ci_builds_metadata_on_build_id_convert_to_bigint", :algorithm=>:concurrently})
   -> 0.0024s
-- add_index("ci_builds_metadata", :build_id_convert_to_bigint, {:unique=>true, :name=>"index_ci_builds_metadata_on_build_id_convert_to_bigint", :algorithm=>:concurrently})
   -> 0.0019s
-- transaction_open?()
   -> 0.0000s
-- foreign_keys("ci_builds_metadata")
   -> 0.0030s
-- execute("ALTER TABLE ci_builds_metadata\nADD CONSTRAINT fk_200e893612\nFOREIGN KEY (build_id_convert_to_bigint)\nREFERENCES ci_builds (id)\nON DELETE CASCADE\nNOT VALID;\n")
   -> 0.0015s
-- execute("ALTER TABLE ci_builds_metadata VALIDATE CONSTRAINT fk_200e893612;")
   -> 0.0071s
-- execute("LOCK TABLE ci_builds_metadata, ci_builds IN ACCESS EXCLUSIVE MODE")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name(:id)
   -> 0.0000s
-- quote_column_name("id_tmp")
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"id\" TO \"id_tmp\"")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name(:id_convert_to_bigint)
   -> 0.0000s
-- quote_column_name(:id)
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"id_convert_to_bigint\" TO \"id\"")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name("id_tmp")
   -> 0.0000s
-- quote_column_name(:id_convert_to_bigint)
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"id_tmp\" TO \"id_convert_to_bigint\"")
   -> 0.0004s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name(:build_id)
   -> 0.0000s
-- quote_column_name("build_id_tmp")
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"build_id\" TO \"build_id_tmp\"")
   -> 0.0004s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name(:build_id_convert_to_bigint)
   -> 0.0000s
-- quote_column_name(:build_id)
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"build_id_convert_to_bigint\" TO \"build_id\"")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name("build_id_tmp")
   -> 0.0000s
-- quote_column_name(:build_id_convert_to_bigint)
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"build_id_tmp\" TO \"build_id_convert_to_bigint\"")
   -> 0.0004s
-- quote_table_name("trigger_542d6c2ad72e")
   -> 0.0000s
-- execute("ALTER FUNCTION \"trigger_542d6c2ad72e\" RESET ALL")
   -> 0.0006s
-- quote_table_name("trigger_8487d4de3e7b")
   -> 0.0000s
-- execute("ALTER FUNCTION \"trigger_8487d4de3e7b\" RESET ALL")
   -> 0.0004s
-- execute("ALTER SEQUENCE ci_builds_metadata_id_seq OWNED BY ci_builds_metadata.id")
   -> 0.0006s
-- change_column_default("ci_builds_metadata", :id, #<Proc:0x00007fd2550e8998 /Users/ali/code/gdk/gitlab/db/migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb:59 (lambda)>)
   -> 0.0025s
-- change_column_default("ci_builds_metadata", :id_convert_to_bigint, 0)
   -> 0.0018s
-- change_column_default("ci_builds_metadata", :build_id, nil)
   -> 0.0016s
-- change_column_default("ci_builds_metadata", :build_id_convert_to_bigint, 0)
   -> 0.0016s
-- execute("ALTER TABLE ci_builds_metadata DROP CONSTRAINT ci_builds_metadata_pkey CASCADE")
   -> 0.0006s
-- rename_index("ci_builds_metadata", "index_ci_builds_metadata_on_id_convert_to_bigint", "ci_builds_metadata_pkey")
   -> 0.0007s
-- execute("ALTER TABLE ci_builds_metadata ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY USING INDEX ci_builds_metadata_pkey")
   -> 0.0006s
-- execute("DROP INDEX index_ci_builds_metadata_on_build_id")
   -> 0.0005s
-- rename_index("ci_builds_metadata", "index_ci_builds_metadata_on_build_id_convert_to_bigint", "index_ci_builds_metadata_on_build_id")
   -> 0.0005s
-- execute("DROP INDEX index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts")
   -> 0.0005s
-- rename_index("ci_builds_metadata", "index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts", "index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts")
   -> 0.0005s
-- execute("DROP INDEX index_ci_builds_metadata_on_build_id_and_id_and_interruptible")
   -> 0.0006s
-- rename_index("ci_builds_metadata", "index_ci_builds_metadata_on_build_id_int8_and_id_int8_and_inter", "index_ci_builds_metadata_on_build_id_and_id_and_interruptible")
   -> 0.0006s
-- remove_foreign_key("ci_builds_metadata", {:name=>"fk_e20479742e"})
   -> 0.0034s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name("fk_200e893612")
   -> 0.0000s
-- quote_column_name("fk_e20479742e")
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\"\nRENAME CONSTRAINT \"fk_200e893612\" TO \"fk_e20479742e\"\n")
   -> 0.0007s
== 20210708011426 FinalizeCiBuildsMetadataBigintConversion: migrated (0.0848s)
Migration down
== 20210708011426 FinalizeCiBuildsMetadataBigintConversion: reverting =========
-- transaction_open?()
   -> 0.0000s
-- index_exists?("ci_builds_metadata", :id_convert_to_bigint, {:unique=>true, :name=>"index_ci_builds_metadata_on_id_convert_to_bigint", :algorithm=>:concurrently})
   -> 0.0036s
-- execute("SET statement_timeout TO 0")
   -> 0.0005s
-- add_index("ci_builds_metadata", :id_convert_to_bigint, {:unique=>true, :name=>"index_ci_builds_metadata_on_id_convert_to_bigint", :algorithm=>:concurrently})
   -> 0.0040s
-- execute("RESET ALL")
   -> 0.0004s
-- transaction_open?()
   -> 0.0000s
-- index_exists?("ci_builds_metadata", :build_id_convert_to_bigint, {:where=>"has_exposed_artifacts IS TRUE", :name=>"index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts", :algorithm=>:concurrently})
   -> 0.0019s
-- add_index("ci_builds_metadata", :build_id_convert_to_bigint, {:where=>"has_exposed_artifacts IS TRUE", :name=>"index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts", :algorithm=>:concurrently})
   -> 0.0019s
-- indexes("ci_builds_metadata")
   -> 0.0021s
-- current_schema()
   -> 0.0001s
-- execute("CREATE INDEX CONCURRENTLY index_ci_builds_metadata_on_build_id_int8_and_id_int8_and_inter\nON ci_builds_metadata (build_id_convert_to_bigint) INCLUDE (id_convert_to_bigint)\nWHERE interruptible = true\n")
   -> 0.0015s
-- transaction_open?()
   -> 0.0000s
-- index_exists?("ci_builds_metadata", :build_id_convert_to_bigint, {:unique=>true, :name=>"index_ci_builds_metadata_on_build_id_convert_to_bigint", :algorithm=>:concurrently})
   -> 0.0021s
-- add_index("ci_builds_metadata", :build_id_convert_to_bigint, {:unique=>true, :name=>"index_ci_builds_metadata_on_build_id_convert_to_bigint", :algorithm=>:concurrently})
   -> 0.0019s
-- transaction_open?()
   -> 0.0000s
-- foreign_keys("ci_builds_metadata")
   -> 0.0026s
-- execute("ALTER TABLE ci_builds_metadata\nADD CONSTRAINT fk_200e893612\nFOREIGN KEY (build_id_convert_to_bigint)\nREFERENCES ci_builds (id)\nON DELETE CASCADE\nNOT VALID;\n")
   -> 0.0016s
-- execute("ALTER TABLE ci_builds_metadata VALIDATE CONSTRAINT fk_200e893612;")
   -> 0.0093s
-- execute("LOCK TABLE ci_builds_metadata, ci_builds IN ACCESS EXCLUSIVE MODE")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name(:id)
   -> 0.0000s
-- quote_column_name("id_tmp")
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"id\" TO \"id_tmp\"")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name(:id_convert_to_bigint)
   -> 0.0000s
-- quote_column_name(:id)
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"id_convert_to_bigint\" TO \"id\"")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name("id_tmp")
   -> 0.0000s
-- quote_column_name(:id_convert_to_bigint)
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"id_tmp\" TO \"id_convert_to_bigint\"")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name(:build_id)
   -> 0.0000s
-- quote_column_name("build_id_tmp")
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"build_id\" TO \"build_id_tmp\"")
   -> 0.0007s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name(:build_id_convert_to_bigint)
   -> 0.0000s
-- quote_column_name(:build_id)
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"build_id_convert_to_bigint\" TO \"build_id\"")
   -> 0.0005s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name("build_id_tmp")
   -> 0.0000s
-- quote_column_name(:build_id_convert_to_bigint)
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\" RENAME COLUMN \"build_id_tmp\" TO \"build_id_convert_to_bigint\"")
   -> 0.0004s
-- quote_table_name("trigger_542d6c2ad72e")
   -> 0.0000s
-- execute("ALTER FUNCTION \"trigger_542d6c2ad72e\" RESET ALL")
   -> 0.0004s
-- quote_table_name("trigger_8487d4de3e7b")
   -> 0.0000s
-- execute("ALTER FUNCTION \"trigger_8487d4de3e7b\" RESET ALL")
   -> 0.0004s
-- execute("ALTER SEQUENCE ci_builds_metadata_id_seq OWNED BY ci_builds_metadata.id")
   -> 0.0004s
-- change_column_default("ci_builds_metadata", :id, #<Proc:0x00007f7f1b0ebb58 /Users/ali/code/gdk/gitlab/db/migrate/20210708011426_finalize_ci_builds_metadata_bigint_conversion.rb:61 (lambda)>)
   -> 0.0019s
-- change_column_default("ci_builds_metadata", :id_convert_to_bigint, 0)
   -> 0.0016s
-- change_column_default("ci_builds_metadata", :build_id, nil)
   -> 0.0013s
-- change_column_default("ci_builds_metadata", :build_id_convert_to_bigint, 0)
   -> 0.0014s
-- execute("ALTER TABLE ci_builds_metadata DROP CONSTRAINT ci_builds_metadata_pkey CASCADE")
   -> 0.0006s
-- rename_index("ci_builds_metadata", "index_ci_builds_metadata_on_id_convert_to_bigint", "ci_builds_metadata_pkey")
   -> 0.0004s
-- execute("ALTER TABLE ci_builds_metadata ADD CONSTRAINT ci_builds_metadata_pkey PRIMARY KEY USING INDEX ci_builds_metadata_pkey")
   -> 0.0005s
-- execute("DROP INDEX index_ci_builds_metadata_on_build_id")
   -> 0.0004s
-- rename_index("ci_builds_metadata", "index_ci_builds_metadata_on_build_id_convert_to_bigint", "index_ci_builds_metadata_on_build_id")
   -> 0.0005s
-- execute("DROP INDEX index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts")
   -> 0.0005s
-- rename_index("ci_builds_metadata", "index_ci_builds_metadata_on_build_id_int8_and_exposed_artifacts", "index_ci_builds_metadata_on_build_id_and_has_exposed_artifacts")
   -> 0.0004s
-- execute("DROP INDEX index_ci_builds_metadata_on_build_id_and_id_and_interruptible")
   -> 0.0004s
-- rename_index("ci_builds_metadata", "index_ci_builds_metadata_on_build_id_int8_and_id_int8_and_inter", "index_ci_builds_metadata_on_build_id_and_id_and_interruptible")
   -> 0.0004s
-- remove_foreign_key("ci_builds_metadata", {:name=>"fk_e20479742e"})
   -> 0.0030s
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name("fk_200e893612")
   -> 0.0000s
-- quote_column_name("fk_e20479742e")
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\"\nRENAME CONSTRAINT \"fk_200e893612\" TO \"fk_e20479742e\"\n")
   -> 0.0005s
== 20210708011426 FinalizeCiBuildsMetadataBigintConversion: reverted (0.0783s) 

== 20210708011425 RenameCiBuildsMetadataForeignKey: reverting =================
-- quote_table_name("ci_builds_metadata")
   -> 0.0000s
-- quote_column_name("fk_e20479742e")
   -> 0.0000s
-- quote_column_name("fk_rails_e20479742e")
   -> 0.0000s
-- execute("ALTER TABLE \"ci_builds_metadata\"\nRENAME CONSTRAINT \"fk_e20479742e\" TO \"fk_rails_e20479742e\"\n")
   -> 0.0006s
== 20210708011425 RenameCiBuildsMetadataForeignKey: reverted (0.0031s) ========

Does this MR meet the acceptance criteria?

Conformity

Edited by Simon Tomlinson