Skip to content

Migration: Add column visibility_pipeline_id_type to user_preferences

What does this MR do and why?

Related issue: #403313 (closed)

Subsequent MRs: !117840 (merged) !117841 (merged)

Add a column visibility_pipeline_id_type to table user_preferences, which is used to store the user's choice - show id or show iid.

Why use variable name: visibility_pipeline_id_type

Referring to the visibilityPipelineID in the old code, I added a suffix _type to make it not look like an id.

Migration log

Migrate

# bin/rails db:migrate

main: == [advisory_lock_connection] object_id: 274240, pg_backend_pid: 71185
main: == 20230417145900 AddVisibilityPipelineIdTypeToUserPreferences: migrating =====
main: -- add_column(:user_preferences, :visibility_pipeline_id_type, :integer, {:default=>0, :limit=>2, :null=>false})
main:    -> 0.0024s
main: == 20230417145900 AddVisibilityPipelineIdTypeToUserPreferences: migrated (0.0067s) 

main: == [advisory_lock_connection] object_id: 274240, pg_backend_pid: 71185

Rollback

# bin/rails db:rollback:main STEP=1

main: == [advisory_lock_connection] object_id: 274200, pg_backend_pid: 72821
main: == 20230417145900 AddVisibilityPipelineIdTypeToUserPreferences: reverting =====
main: -- remove_column(:user_preferences, :visibility_pipeline_id_type, :integer, {:default=>0, :limit=>2, :null=>false})
main:    -> 0.0028s
main: == 20230417145900 AddVisibilityPipelineIdTypeToUserPreferences: reverted (0.0086s) 

main: == [advisory_lock_connection] object_id: 274200, pg_backend_pid: 72821

Screenshots or screen recordings

No UI changes.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

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


cc @mtan-gitlab @icbd @chaomao

Edited by Zhiyuan Lu

Merge request reports