Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 04:45:44 +0300
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb')
-rw-r--r--db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb b/db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb
new file mode 100644
index 00000000000..0ba8f12f89e
--- /dev/null
+++ b/db/migrate/20200902135542_update_package_max_file_size_plan_limits.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+
+class UpdatePackageMaxFileSizePlanLimits < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def up
+ # this is intended to be a no-op for GitLab.com
+ # 5GB is the value for these columns as of 2020-09-02
+ if Gitlab.com?
+ update_all_plan_limits('conan_max_file_size', 5.gigabytes)
+ update_all_plan_limits('maven_max_file_size', 5.gigabytes)
+ update_all_plan_limits('npm_max_file_size', 5.gigabytes)
+ update_all_plan_limits('nuget_max_file_size', 5.gigabytes)
+ update_all_plan_limits('pypi_max_file_size', 5.gigabytes)
+ else
+ update_all_plan_limits('conan_max_file_size', 3.gigabytes)
+ update_all_plan_limits('maven_max_file_size', 3.gigabytes)
+ update_all_plan_limits('npm_max_file_size', 500.megabytes)
+ update_all_plan_limits('nuget_max_file_size', 500.megabytes)
+ update_all_plan_limits('pypi_max_file_size', 3.gigabytes)
+ end
+ end
+
+ def down
+ update_all_plan_limits('conan_max_file_size', 50.megabytes)
+ update_all_plan_limits('maven_max_file_size', 50.megabytes)
+ update_all_plan_limits('npm_max_file_size', 50.megabytes)
+ update_all_plan_limits('nuget_max_file_size', 50.megabytes)
+ update_all_plan_limits('pypi_max_file_size', 50.megabytes)
+ end
+
+ private
+
+ def update_all_plan_limits(limit_name, limit_value)
+ limit_name_quoted = quote_column_name(limit_name)
+ limit_value_quoted = quote(limit_value)
+
+ execute <<~SQL
+ UPDATE plan_limits
+ SET #{limit_name_quoted} = #{limit_value_quoted};
+ SQL
+ end
+end