diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 21:07:54 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-24 21:07:54 +0000 |
commit | c4db541c1b2c97ab1eda354ea3899489fe5c33e5 (patch) | |
tree | 45d5d381232179082ea11136e3b53211b37349d5 /doc/development/application_limits.md | |
parent | 603c7d4cac5e28bc1c75e50c23ed2cbe56f1aafc (diff) | |
download | gitlab-ce-c4db541c1b2c97ab1eda354ea3899489fe5c33e5.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development/application_limits.md')
-rw-r--r-- | doc/development/application_limits.md | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/doc/development/application_limits.md b/doc/development/application_limits.md index f50730634b7..3592bb29f85 100644 --- a/doc/development/application_limits.md +++ b/doc/development/application_limits.md @@ -20,40 +20,45 @@ limits](https://about.gitlab.com/handbook/product/#introducing-application-limit In the `plan_limits` table, you have to create a new column and insert the limit values. It's recommended to create separate migration script files. -1. Add new column to the `plan_limits` table with non-null default value 0, eg: - - ```ruby - add_column(:plan_limits, :project_hooks, :integer, default: 0, null: false) - ``` - - NOTE: **Note:** Plan limits entries set to `0` mean that limits are not - enabled. - -1. Insert plan limits values into the database using - `create_or_update_plan_limit` migration helper, eg: - - ```ruby - def up - return unless Gitlab.com? - - create_or_update_plan_limit('project_hooks', 'free', 100) - create_or_update_plan_limit('project_hooks', 'bronze', 100) - create_or_update_plan_limit('project_hooks', 'silver', 100) - create_or_update_plan_limit('project_hooks', 'gold', 100) - end - - def down - return unless Gitlab.com? - - create_or_update_plan_limit('project_hooks', 'free', 0) - create_or_update_plan_limit('project_hooks', 'bronze', 0) - create_or_update_plan_limit('project_hooks', 'silver', 0) - create_or_update_plan_limit('project_hooks', 'gold', 0) - end - ``` - -NOTE: **Note:** Some plans exist only on GitLab.com. You can check if the -migration is running on GitLab.com with `Gitlab.com?`. +1. Add new column to the `plan_limits` table with non-null default value + that represents desired limit, eg: + + ```ruby + add_column(:plan_limits, :project_hooks, :integer, default: 100, null: false) + ``` + + NOTE: **Note:** Plan limits entries set to `0` mean that limits are not + enabled. You should use this setting only in special and documented circumstances. + +1. (Optionally) Create the database migration that fine-tunes each level with + a desired limit using `create_or_update_plan_limit` migration helper, eg: + + ```ruby + class InsertProjectHooksPlanLimits < ActiveRecord::Migration[5.2] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + create_or_update_plan_limit('project_hooks', 'default', 0) + create_or_update_plan_limit('project_hooks', 'free', 10) + create_or_update_plan_limit('project_hooks', 'bronze', 20) + create_or_update_plan_limit('project_hooks', 'silver', 30) + create_or_update_plan_limit('project_hooks', 'gold', 100) + end + + def down + create_or_update_plan_limit('project_hooks', 'default', 0) + create_or_update_plan_limit('project_hooks', 'free', 0) + create_or_update_plan_limit('project_hooks', 'bronze', 0) + create_or_update_plan_limit('project_hooks', 'silver', 0) + create_or_update_plan_limit('project_hooks', 'gold', 0) + end + end + ``` + +NOTE: **Note:** Some plans exist only on GitLab.com. This will be no-op +for plans that do not exist. ### Plan limits validation |