summaryrefslogtreecommitdiff
path: root/app/models/concerns/sha_attribute.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/concerns/sha_attribute.rb')
-rw-r--r--app/models/concerns/sha_attribute.rb13
1 files changed, 3 insertions, 10 deletions
diff --git a/app/models/concerns/sha_attribute.rb b/app/models/concerns/sha_attribute.rb
index c807dcbf418..cbac6a210c7 100644
--- a/app/models/concerns/sha_attribute.rb
+++ b/app/models/concerns/sha_attribute.rb
@@ -7,7 +7,7 @@ module ShaAttribute
def sha_attribute(name)
return if ENV['STATIC_VERIFICATION']
- validate_binary_column_exists!(name) unless Rails.env.production?
+ validate_binary_column_exists!(name) if Rails.env.development?
attribute(name, Gitlab::Database::ShaAttribute.new)
end
@@ -17,18 +17,11 @@ module ShaAttribute
# See https://gitlab.com/gitlab-org/gitlab/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
- end
+ return unless table_exists?
column = columns.find { |c| c.name == name.to_s }
- unless column
- warn "WARNING: sha_attribute #{name.inspect} is invalid since the column doesn't exist - you may need to run database migrations"
- return
- end
+ return unless column
unless column.type == :binary
raise ArgumentError.new("sha_attribute #{name.inspect} is invalid since the column type is not :binary")