diff options
author | Shinya Maeda <shinya@gitlab.com> | 2019-02-20 09:37:49 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2019-02-27 11:12:04 +0300 |
commit | 314062fec5a1d1f56a63202fa16fc7dacc876083 (patch) | |
tree | 1eccb736a2de4274ece3f9acc1c74efe9033ff8c /app/models/concerns/sha_attribute.rb | |
parent | aa77c5bd342a625c99eba8d0c1fb625b6811d412 (diff) |
Persist source sha and target sha for merge pipelines
source_sha and target_sha are used for merge request pipelines
Diffstat (limited to 'app/models/concerns/sha_attribute.rb')
-rw-r--r-- | app/models/concerns/sha_attribute.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb index e51b4e22c96..a479bef993c 100644 --- a/app/models/concerns/sha_attribute.rb +++ b/app/models/concerns/sha_attribute.rb @@ -16,6 +16,8 @@ module ShaAttribute # the column is the correct type. In production it should behave like any other attribute. # See https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5502 for more discussion def validate_binary_column_exists!(name) + return unless database_exists? + unless table_exists? warn "WARNING: sha_attribute #{name.inspect} is invalid since the table doesn't exist - you may need to run database migrations" return @@ -35,5 +37,13 @@ module ShaAttribute Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}" raise end + + def database_exists? + ActiveRecord::Base.connection + + true + rescue + false + end end end |