diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 06:07:58 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 06:07:58 +0000 |
commit | 9c83aadd2604e7e6cb1f84683f951e6b12872618 (patch) | |
tree | c0a14c87378e832e87580be382e1c8ccea188b71 /app/models/environment.rb | |
parent | 23bc19cb73aad969c9636b8b935111645e809e54 (diff) | |
download | gitlab-ce-9c83aadd2604e7e6cb1f84683f951e6b12872618.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/environment.rb')
-rw-r--r-- | app/models/environment.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/environment.rb b/app/models/environment.rb index e9b1c55726d..fecf13f349e 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -3,6 +3,7 @@ class Environment < ApplicationRecord include Gitlab::Utils::StrongMemoize include ReactiveCaching + include FastDestroyAll::Helpers self.reactive_cache_refresh_interval = 1.minute self.reactive_cache_lifetime = 55.seconds @@ -10,7 +11,10 @@ class Environment < ApplicationRecord belongs_to :project, required: true - has_many :deployments, -> { visible }, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent + use_fast_destroy :all_deployments + + has_many :all_deployments, class_name: 'Deployment' + has_many :deployments, -> { visible } has_many :successful_deployments, -> { success }, class_name: 'Deployment' has_many :active_deployments, -> { active }, class_name: 'Deployment' has_many :prometheus_alerts, inverse_of: :environment |