Skip to content

Adds last_dormant_member_review_at to namespace settings

What does this MR do and why?

As part of [BE] Remove dormant members (#461340) we are going to allow customers to have their dormant members removed from a namespace hierarchy.

To handle the removal, we are going to use a limited capacity worker that can check for any remove dormant members on a daily basis (being handled in !157930).

In order to do that, in this MR we are adding a last_dormant_member_review_at timestamp column to the NamespaceSettings table.

As recommended in !153100 (comment 1912378314), this migration also adds an index.

Refs #461340

Migration details

Migrating up:

bin/rails db:migrate
main: == [advisory_lock_connection] object_id: 128460, pg_backend_pid: 18416
main: == 20240701102528 AddLastDormantMemberReviewAtToNamespaceSettings: migrating ==
main: -- add_column(:namespace_settings, :last_dormant_member_review_at, :datetime_with_timezone)
main:    -> 0.0023s
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0171s
main: -- index_exists?(:namespace_settings, [:last_dormant_member_review_at, :namespace_id], {:where=>"remove_dormant_members IS true", :name=>"idx_namespace_settings_on_last_dormant_member_review_at_id", :algorithm=>:concurrently})
main:    -> 0.0027s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0007s
main: -- add_index(:namespace_settings, [:last_dormant_member_review_at, :namespace_id], {:where=>"remove_dormant_members IS true", :name=>"idx_namespace_settings_on_last_dormant_member_review_at_id", :algorithm=>:concurrently})
main:    -> 0.0022s
main: -- execute("RESET statement_timeout")
main:    -> 0.0003s
main: == 20240701102528 AddLastDormantMemberReviewAtToNamespaceSettings: migrated (0.0396s) 

Migrating down:

 bin/rails db:migrate:down:main VERSION=20240701102528
main: == [advisory_lock_connection] object_id: 128100, pg_backend_pid: 14432
main: == 20240701102528 AddLastDormantMemberReviewAtToNamespaceSettings: reverting ==
main: -- remove_column(:namespace_settings, :last_dormant_member_review_at)
main:    -> 0.0032s
main: == 20240701102528 AddLastDormantMemberReviewAtToNamespaceSettings: reverted (0.0070s) 

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

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

Edited by Vijay Hawoldar

Merge request reports