diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-17 21:10:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-17 21:10:35 +0300 |
commit | 4484c8523126ee1de864bbcac43c706252d580be (patch) | |
tree | 5dff926e0deb8d55ce79c7c563f8fa7b1706a128 /app/models/projects | |
parent | 20dbd96076a6d09d20a9ac3caa1f35506d82340b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/projects')
-rw-r--r-- | app/models/projects/ci_feature_usage.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/models/projects/ci_feature_usage.rb b/app/models/projects/ci_feature_usage.rb new file mode 100644 index 00000000000..a10426e50c9 --- /dev/null +++ b/app/models/projects/ci_feature_usage.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +module Projects + class CiFeatureUsage < ApplicationRecord + self.table_name = 'project_ci_feature_usages' + + belongs_to :project + + validates :project, :feature, presence: true + + enum feature: { + code_coverage: 1, + security_report: 2 + } + + def self.insert_usage(project_id:, feature:, default_branch:) + insert( + { + project_id: project_id, + feature: feature, + default_branch: default_branch + }, + unique_by: 'index_project_ci_feature_usages_unique_columns' + ) + end + end +end |