summaryrefslogtreecommitdiff
path: root/app/models/chat_name.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-27 15:13:41 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-27 15:13:41 +0000
commitf50cb4f63fae6f02a0b8d9c3a95f29b3b4f79516 (patch)
treeb6bcddc7b76089f91cc6143d141440cb63adfcbd /app/models/chat_name.rb
parent0a559c913e4d333f339fcc03b89bfeade9ca0b93 (diff)
downloadgitlab-ce-f50cb4f63fae6f02a0b8d9c3a95f29b3b4f79516.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/chat_name.rb')
-rw-r--r--app/models/chat_name.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/chat_name.rb b/app/models/chat_name.rb
index ff3f2663b73..da7312df18b 100644
--- a/app/models/chat_name.rb
+++ b/app/models/chat_name.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
class ChatName < ApplicationRecord
+ include LooseForeignKey
+
LAST_USED_AT_INTERVAL = 1.hour
belongs_to :integration, foreign_key: :service_id
@@ -14,6 +16,8 @@ class ChatName < ApplicationRecord
validates :user_id, uniqueness: { scope: [:service_id] }
validates :chat_id, uniqueness: { scope: [:service_id, :team_id] }
+ loose_foreign_key :ci_pipeline_chat_data, :chat_name_id, on_delete: :async_delete
+
# Updates the "last_used_timestamp" but only if it wasn't already updated
# recently.
#