Drop `last_edited_by_id` Column From Vulnerabilities
What does this MR do and why?
last_edited_by_id
is an ignored column (source)
This MR drops the column for step 2 of the 3-MR drop column process
Check for indexes or constraints
Using the command \d+ vulnerabilities
on postgres.ai indicates there ARE indexes and constraints
index | fk constraint |
---|---|
migration output
bundle exec rails db:migrate
output
~/gitlab-development-kit/gitlab$ bundle exec rails db:migrate
main: == [advisory_lock_connection] object_id: 182860, pg_backend_pid: 921792
main: == 20231219083824 RemoveLastEditedByIdColumnFromVulnerabilities: migrating ====
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- remove_column(:vulnerabilities, :last_edited_by_id)
main: -> 0.0053s
main: == 20231219083824 RemoveLastEditedByIdColumnFromVulnerabilities: migrated (0.0162s)
main: == [advisory_lock_connection] object_id: 182860, pg_backend_pid: 921792
ci: == [advisory_lock_connection] object_id: 183100, pg_backend_pid: 921794
ci: == 20231219083824 RemoveLastEditedByIdColumnFromVulnerabilities: migrating ====
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- remove_column(:vulnerabilities, :last_edited_by_id)
ci: -> 0.0049s
ci: == 20231219083824 RemoveLastEditedByIdColumnFromVulnerabilities: migrated (0.0171s)
ci: == [advisory_lock_connection] object_id: 183100, pg_backend_pid: 921794
bundle exec rails db:rollback:main
output
~/gitlab-development-kit/gitlab$ bundle exec rails db:rollback:main
main: == [advisory_lock_connection] object_id: 182440, pg_backend_pid: 102780
main: == 20231224083824 RemoveLastEditedByIdColumnFromVulnerabilities: reverting ====
main: -- column_exists?(:vulnerabilities, :last_edited_by_id)
main: -> 0.0154s
main: -- add_column(:vulnerabilities, :last_edited_by_id, :bigint)
main: -> 0.0006s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0005s
main: -- index_exists?(:vulnerabilities, :last_edited_by_id, {:algorithm=>:concurrently})
main: -> 0.0055s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0002s
main: -- add_index(:vulnerabilities, :last_edited_by_id, {:algorithm=>:concurrently})
main: -> 0.0026s
main: -- execute("RESET statement_timeout")
main: -> 0.0002s
main: -- index_name(:vulnerabilities, :last_edited_by_id)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- transaction_open?(nil)
main: -> 0.0000s
main: -- execute("ALTER TABLE vulnerabilities ADD CONSTRAINT fk_1302949740 FOREIGN KEY (last_edited_by_id) REFERENCES users (id) ON DELETE SET NULL NOT VALID;")
main: -> 0.0022s
main: -- execute("ALTER TABLE vulnerabilities VALIDATE CONSTRAINT fk_1302949740;")
main: -> 0.0071s
main: == 20231224083824 RemoveLastEditedByIdColumnFromVulnerabilities: reverted (0.0605s)
main: == [advisory_lock_connection] object_id: 182440, pg_backend_pid: 102780
bundle exec rails db:rollback:ci
output
~/gitlab-development-kit/gitlab$ bundle exec rails db:rollback:ci
ci: == [advisory_lock_connection] object_id: 182520, pg_backend_pid: 924823
ci: == 20231219083824 RemoveLastEditedByIdColumnFromVulnerabilities: reverting ====
ci: -- column_exists?(:vulnerabilities, :last_edited_by_id)
ci: -> 0.0212s
ci: -- add_column(:vulnerabilities, :last_edited_by_id, :bigint)
ci: -> 0.0011s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci: -> 0.0008s
ci: -- index_exists?(:vulnerabilities, :last_edited_by_id, {:algorithm=>:concurrently})
ci: -> 0.0170s
ci: -- execute("SET statement_timeout TO 0")
ci: -> 0.0005s
ci: -- add_index(:vulnerabilities, :last_edited_by_id, {:algorithm=>:concurrently})
ci: -> 0.0013s
ci: -- execute("RESET statement_timeout")
ci: -> 0.0005s
ci: -- index_name(:vulnerabilities, :last_edited_by_id)
ci: -> 0.0000s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- transaction_open?(nil)
ci: -> 0.0000s
ci: -- execute("ALTER TABLE vulnerabilities ADD CONSTRAINT fk_1302949740 FOREIGN KEY (last_edited_by_id) REFERENCES users (id) ON DELETE SET NULL NOT VALID;")
ci: -> 0.0031s
ci: -- execute("ALTER TABLE vulnerabilities VALIDATE CONSTRAINT fk_1302949740;")
ci: -> 0.0099s
ci: == 20231219083824 RemoveLastEditedByIdColumnFromVulnerabilities: reverted (0.1123s)
ci: == [advisory_lock_connection] object_id: 182520, pg_backend_pid: 924823
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #268154 (closed)
Edited by Michael Becker