Skip to content

Add application settings to support inactive project deletion feature

What does this MR do and why?

Describe in detail what your merge request does and why.

Add application settings to support inactive project deletion feature.

Database

Migration up

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/9621/commands/34094

== 20220406113217 AddInactiveProjectDeletionToApplicationSettings: migrating ==
-- add_column(:application_settings, :delete_inactive_projects, :boolean, {:default=>false, :null=>false})
   -> 0.0070s
-- add_column(:application_settings, :inactive_projects_delete_after_months, :integer, {:default=>2, :null=>false})
   -> 0.0025s
-- add_column(:application_settings, :inactive_projects_min_size_mb, :integer, {:default=>0, :null=>false})
   -> 0.0021s
-- add_column(:application_settings, :inactive_projects_send_warning_email_after_months, :integer, {:default=>1, :null=>false})
   -> 0.0018s
== 20220406113217 AddInactiveProjectDeletionToApplicationSettings: migrated (0.0136s)

Migration down

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/9621/commands/34095

== 20220406113217 AddInactiveProjectDeletionToApplicationSettings: reverting ==
-- remove_column(:application_settings, :inactive_projects_send_warning_email_after_months, :integer, {:default=>1, :null=>false})
   -> 0.0033s
-- remove_column(:application_settings, :inactive_projects_min_size_mb, :integer, {:default=>0, :null=>false})
   -> 0.0015s
-- remove_column(:application_settings, :inactive_projects_delete_after_months, :integer, {:default=>2, :null=>false})
   -> 0.0036s
-- remove_column(:application_settings, :delete_inactive_projects, :boolean, {:default=>false, :null=>false})
   -> 0.0074s
== 20220406113217 AddInactiveProjectDeletionToApplicationSettings: reverted (0.0180s)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

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

  1. Run the migration bundle exec rails db:migrate
  2. Verify that the new rows in the application_settings table are added.
  3. Modify the values using the application settings API. Example {{baseURL}}/api/v4/application/settings?inactive_projects_delete_after=3&inactive_projects_min_size_mb=5&inactive_projects_send_warning_email_after=1
  4. Check the documentation changes - http://gdk.test:3005/ee/api/settings.html

MR acceptance checklist

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

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/357372

Edited by Huzaifa Iftikhar

Merge request reports