Skip to content

Add storage_size_limit to plan_limits table

Shreyas Agarwal requested to merge 222980-add-static-info-for-storage into master

What does this MR do?

To specify the cap for each plan for the storage I have added storage_size_limit column which will specify in MB the value each plan can have by default.

Why this change ?

When called actual_plan method for a namespace, it checks if the gitlab_subscription is present or not and if not then it either creates one with free plan and if the subscription is present then it checks it plan and if nothing seems to appear for GL.com it returns free plan.

Every plan has plan_limits entry and hence when specified storage_size_limit within the plan_limits provide the comfort and control to change the values in future whenever needed without having to change the codebase. As there are only 6 plans there are only 6 plan_limits in the database at the time of writing this description.

Database Migration

== 20200624075411 AddStorageSizeLimitToPlanLimit: migrating ===================
-- add_column(:plan_limits, :storage_size_limit, :integer, {:default=>0, :null=>false})
   -> 0.0053s
== 20200624075411 AddStorageSizeLimitToPlanLimit: migrated (0.0054s) ==========
== 20200624075411 AddStorageSizeLimitToPlanLimit: reverting ===================
-- remove_column(:plan_limits, :storage_size_limit, :integer, {:default=>0, :null=>false})
   -> 0.0034s
== 20200624075411 AddStorageSizeLimitToPlanLimit: reverted (0.0071s) ==========

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Part of #222980

Merge request reports