summaryrefslogtreecommitdiff
path: root/lib/gitlab/database
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 12:08:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-17 12:08:11 +0000
commitbadb9c1deacbea601b02f88811b7e123589d9251 (patch)
treef4b4f85db49a8c9fc9bd6233ed9f7862c9de8ded /lib/gitlab/database
parent5bd24a54ef4ce3a38a860eb53b66d062c2382971 (diff)
downloadgitlab-ce-badb9c1deacbea601b02f88811b7e123589d9251.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/database')
-rw-r--r--lib/gitlab/database/migration_helpers.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb
index 03bde611451..f9340b262e5 100644
--- a/lib/gitlab/database/migration_helpers.rb
+++ b/lib/gitlab/database/migration_helpers.rb
@@ -1052,6 +1052,15 @@ into similar problems in the future (e.g. when new tables are created).
connection.select_value(index_sql).to_i > 0
end
+ def create_or_update_plan_limit(limit_name, plan_name, 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)};
+ SQL
+ end
+
private
def tables_match?(target_table, foreign_key_table)