Skip to content

Drop `due_date_sourcing_milestone_id` column From Vulnerabilities

What does this MR do and why?

due_date_sourcing_milestone_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
image image

migration output

bundle exec rails db:migrate output
~/gitlab-development-kit/gitlab$ bundle exec rails db:migrate 
main: == [advisory_lock_connection] object_id: 182800, pg_backend_pid: 810982
main: == 20231217053910 RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities: migrating 
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- remove_column(:vulnerabilities, :due_date_sourcing_milestone_id)
main:    -> 0.0114s
main: == 20231217053910 RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities: migrated (0.0199s) 

main: == [advisory_lock_connection] object_id: 182800, pg_backend_pid: 810982
ci: == [advisory_lock_connection] object_id: 183040, pg_backend_pid: 810984
ci: == 20231217053910 RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities: migrating 
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- remove_column(:vulnerabilities, :due_date_sourcing_milestone_id)
ci:    -> 0.0024s
ci: == 20231217053910 RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities: migrated (0.0104s) 

ci: == [advisory_lock_connection] object_id: 183040, pg_backend_pid: 810984
bundle exec rails db:rollback:main output
~/gitlab-development-kit/gitlab$ bundle exec rails db:rollback:main
main: == [advisory_lock_connection] object_id: 182540, pg_backend_pid: 812800
main: == 20231217053910 RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities: reverting 
main: -- column_exists?(:vulnerabilities, :due_date_sourcing_milestone_id)
main:    -> 0.0158s
main: -- add_column(:vulnerabilities, :due_date_sourcing_milestone_id, :bigint)
main:    -> 0.0010s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0008s
main: -- index_exists?(:vulnerabilities, :due_date_sourcing_milestone_id, {:algorithm=>:concurrently})
main:    -> 0.0066s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0002s
main: -- add_index(:vulnerabilities, :due_date_sourcing_milestone_id, {:algorithm=>:concurrently})
main:    -> 0.0010s
main: -- execute("RESET statement_timeout")
main:    -> 0.0001s
main: -- index_name(:vulnerabilities, :due_date_sourcing_milestone_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_7c5bb22a22 FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES milestones (id) ON DELETE SET NULL NOT VALID;")
main:    -> 0.0009s
main: -- execute("ALTER TABLE vulnerabilities VALIDATE CONSTRAINT fk_7c5bb22a22;")
main:    -> 0.0010s
main: == 20231217053910 RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities: reverted (0.0556s) 

main: == [advisory_lock_connection] object_id: 182540, pg_backend_pid: 812800
bundle exec rails db:rollback:ci output
~/gitlab-development-kit/gitlab$ bundle exec rails db:rollback:ci
ci: == [advisory_lock_connection] object_id: 182480, pg_backend_pid: 813367
ci: == 20231217053910 RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities: reverting 
ci: -- column_exists?(:vulnerabilities, :due_date_sourcing_milestone_id)
ci:    -> 0.0134s
ci: -- add_column(:vulnerabilities, :due_date_sourcing_milestone_id, :bigint)
ci:    -> 0.0008s
ci: -- transaction_open?(nil)
ci:    -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci:    -> 0.0005s
ci: -- index_exists?(:vulnerabilities, :due_date_sourcing_milestone_id, {:algorithm=>:concurrently})
ci:    -> 0.0079s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0001s
ci: -- add_index(:vulnerabilities, :due_date_sourcing_milestone_id, {:algorithm=>:concurrently})
ci:    -> 0.0008s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0002s
ci: -- index_name(:vulnerabilities, :due_date_sourcing_milestone_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_7c5bb22a22 FOREIGN KEY (due_date_sourcing_milestone_id) REFERENCES milestones (id) ON DELETE SET NULL NOT VALID;")
ci:    -> 0.0007s
ci: -- execute("ALTER TABLE vulnerabilities VALIDATE CONSTRAINT fk_7c5bb22a22;")
ci:    -> 0.0009s
ci: == 20231217053910 RemoveDueDateSourcingMilestoneIdColumnFromVulnerabilities: reverted (0.0562s) 

ci: == [advisory_lock_connection] object_id: 182480, pg_backend_pid: 813367

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #268154 (closed)

Edited by Michael Becker

Merge request reports

Loading