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-03-25 00:07:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-25 00:07:54 +0300
commitc4db541c1b2c97ab1eda354ea3899489fe5c33e5 (patch)
tree45d5d381232179082ea11136e3b53211b37349d5 /lib/gitlab/database
parent603c7d4cac5e28bc1c75e50c23ed2cbe56f1aafc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/database')
-rw-r--r--lib/gitlab/database/migration_helpers.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index 82a84508959..64eef530663 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -1121,11 +1121,14 @@ into similar problems in the future (e.g. when new tables are created).
end
def create_or_update_plan_limit(limit_name, plan_name, limit_value)
+ limit_name_quoted = quote_column_name(limit_name)
+ plan_name_quoted = quote(plan_name)
+ limit_value_quoted = quote(limit_value)
+
execute <<~SQL
- INSERT INTO plan_limits (plan_id, #{quote_column_name(limit_name)})
- VALUES
- ((SELECT id FROM plans WHERE name = #{quote(plan_name)} LIMIT 1), #{quote(limit_value)})
- ON CONFLICT (plan_id) DO UPDATE SET #{quote_column_name(limit_name)} = EXCLUDED.#{quote_column_name(limit_name)};
+ INSERT INTO plan_limits (plan_id, #{limit_name_quoted})
+ SELECT id, #{limit_value_quoted} FROM plans WHERE name = #{plan_name_quoted} LIMIT 1
+ ON CONFLICT (plan_id) DO UPDATE SET #{limit_name_quoted} = EXCLUDED.#{limit_name_quoted};
SQL
end