Commit 7ed5a11b authored by huzaifaiftikhar1's avatar huzaifaiftikhar1 Committed by Huzaifa Iftikhar

Rename column names to include the unit of the time duration

parent 561777df
......@@ -274,9 +274,9 @@ module ApplicationSettingsHelper
:html_emails_enabled,
:import_sources,
:in_product_marketing_emails_enabled,
:inactive_projects_delete_after,
:inactive_projects_delete_after_months,
:inactive_projects_min_size_mb,
:inactive_projects_send_warning_email_after,
:inactive_projects_send_warning_email_after_months,
:invisible_captcha_enabled,
:max_artifacts_size,
:max_attachment_size,
......
......@@ -581,11 +581,11 @@ class ApplicationSetting < ApplicationRecord
validates :inactive_projects_min_size_mb,
numericality: { only_integer: true, greater_than_or_equal_to: 0 }
validates :inactive_projects_delete_after,
validates :inactive_projects_delete_after_months,
numericality: { only_integer: true, greater_than: 0 }
validates :inactive_projects_send_warning_email_after,
numericality: { only_integer: true, greater_than: 0, less_than: :inactive_projects_delete_after }
validates :inactive_projects_send_warning_email_after_months,
numericality: { only_integer: true, greater_than: 0, less_than: :inactive_projects_delete_after_months }
attr_encrypted :asset_proxy_secret_key,
mode: :per_attribute_iv,
......
......@@ -3,8 +3,8 @@
class AddInactiveProjectDeletionToApplicationSettings < Gitlab::Database::Migration[1.0]
def change
add_column :application_settings, :delete_inactive_projects, :boolean, default: false, null: false
add_column :application_settings, :inactive_projects_delete_after, :integer, default: 2, null: false
add_column :application_settings, :inactive_projects_delete_after_months, :integer, default: 2, null: false
add_column :application_settings, :inactive_projects_min_size_mb, :integer, default: 0, null: false
add_column :application_settings, :inactive_projects_send_warning_email_after, :integer, default: 1, null: false
add_column :application_settings, :inactive_projects_send_warning_email_after_months, :integer, default: 1, null: false
end
end
......@@ -11258,9 +11258,9 @@ CREATE TABLE application_settings (
database_grafana_tag text,
public_runner_releases_url text DEFAULT 'https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab-runner/releases'::text NOT NULL,
delete_inactive_projects boolean DEFAULT false NOT NULL,
inactive_projects_delete_after integer DEFAULT 2 NOT NULL,
inactive_projects_delete_after_months integer DEFAULT 2 NOT NULL,
inactive_projects_min_size_mb integer DEFAULT 0 NOT NULL,
inactive_projects_send_warning_email_after integer DEFAULT 1 NOT NULL,
inactive_projects_send_warning_email_after_months integer DEFAULT 1 NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_dep_proxy_ttl_policies_worker_capacity_positive CHECK ((dependency_proxy_ttl_group_policy_worker_capacity >= 0)),
CONSTRAINT app_settings_ext_pipeline_validation_service_url_text_limit CHECK ((char_length(external_pipeline_validation_service_url) <= 255)),
......@@ -351,9 +351,9 @@ listed in the descriptions of the relevant settings.
| `html_emails_enabled` | boolean | no | Enable HTML emails. |
| `import_sources` | array of strings | no | Sources to allow project import from, possible values: `github`, `bitbucket`, `bitbucket_server`, `gitlab`, `fogbugz`, `git`, `gitlab_project`, `gitea`, `manifest`, and `phabricator`. |
| `in_product_marketing_emails_enabled` | boolean | no | Enable [in-product marketing emails](../user/profile/notifications.md#global-notification-settings). Enabled by default. |
| `inactive_projects_delete_after` | integer | no | If `delete_inactive_projects` is `true`, the time (in months) to wait before deleting inactive projects. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
| `inactive_projects_delete_after_months` | integer | no | If `delete_inactive_projects` is `true`, the time (in months) to wait before deleting inactive projects. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
| `inactive_projects_min_size_mb` | integer | no | If `delete_inactive_projects` is `true`, the minimum repository size for projects to be checked for inactivity. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
| `inactive_projects_send_warning_email_after` | integer | no | If `delete_inactive_projects` is `true`, sets the time (in months) to wait before emailing maintainers that the project will be deleted because it is inactive. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
| `inactive_projects_send_warning_email_after_months` | integer | no | If `delete_inactive_projects` is `true`, sets the time (in months) to wait before emailing maintainers that the project will be deleted because it is inactive. [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/84519) in GitLab 14.10. |
| `invisible_captcha_enabled` | boolean | no | Enable Invisible CAPTCHA spam detection during sign-up. Disabled by default. |
| `issues_create_limit` | integer | no | Max number of issue creation requests per minute per user. Disabled by default.|
| `keep_latest_artifact` | boolean | no | Prevent the deletion of the artifacts from the most recent successful jobs, regardless of the expiry time. Enabled by default. |
......
......@@ -1324,16 +1324,16 @@ RSpec.describe ApplicationSetting do
end
context "inactive project deletion" do
it "validates that inactive_projects_send_warning_email_after is less than inactive_projects_delete_after" do
subject[:inactive_projects_delete_after] = 3
subject[:inactive_projects_send_warning_email_after] = 6
it "validates that inactive_projects_send_warning_email_after_months is less than inactive_projects_delete_after_months" do
subject[:inactive_projects_delete_after_months] = 3
subject[:inactive_projects_send_warning_email_after_months] = 6
expect(subject).to be_invalid
end
it { is_expected.to validate_numericality_of(:inactive_projects_send_warning_email_after).is_greater_than(0) }
it { is_expected.to validate_numericality_of(:inactive_projects_send_warning_email_after_months).is_greater_than(0) }
it { is_expected.to validate_numericality_of(:inactive_projects_delete_after).is_greater_than(0) }
it { is_expected.to validate_numericality_of(:inactive_projects_delete_after_months).is_greater_than(0) }
it { is_expected.to validate_numericality_of(:inactive_projects_min_size_mb).is_greater_than_or_equal_to(0) }
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment