Skip to content
Snippets Groups Projects

Persist source sha and target sha for merge pipelines

Merged Shinya Maeda requested to merge persist-source-sha-and-target-sha-for-pipelines into master
All threads resolved!
Compare and Show latest version
1 file
+ 13
0
Compare changes
  • Side-by-side
  • Inline
@@ -16,6 +16,11 @@ def sha_attribute(name)
# 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)
unless database_exists?
warn "WARNING: sha_attribute #{name.inspect} is invalid since the database doesn't exist - you may need to create database at first"
return
end
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 +40,13 @@ def validate_binary_column_exists!(name)
Gitlab::AppLogger.error "ShaAttribute initialization: #{error.message}"
raise
end
def database_exists?
ActiveRecord::Base.connection
rescue ActiveRecord::NoDatabaseError
false
else
true
end
end
end
Loading