diff options
Diffstat (limited to 'app/models/concerns/with_uploads.rb')
-rw-r--r-- | app/models/concerns/with_uploads.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/concerns/with_uploads.rb b/app/models/concerns/with_uploads.rb index d90f32d8b1c..caaf2b33ef0 100644 --- a/app/models/concerns/with_uploads.rb +++ b/app/models/concerns/with_uploads.rb @@ -25,6 +25,13 @@ module WithUploads FILE_UPLOADERS = %w(PersonalFileUploader NamespaceFileUploader FileUploader).freeze included do + around_destroy :ignore_uploads_table_in_transaction + + def ignore_uploads_table_in_transaction(&blk) + Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification.temporary_ignore_tables_in_transaction( + %w[uploads], url: "https://gitlab.com/gitlab-org/gitlab/-/issues/398199", &blk) + end + has_many :uploads, as: :model has_many :file_uploads, -> { where(uploader: FILE_UPLOADERS) }, class_name: 'Upload', as: :model, |