Skip to content
Snippets Groups Projects

Model changes for code owner approval rules

Merged Bob Van Landuyt requested to merge reprazent/gitlab-ee:bvl-codeowner-rules-model into master
All threads resolved!
1 file
+ 5
1
Compare changes
  • Side-by-side
  • Inline
  • 23524ea9
    This makes sure that we don't create a partial unique index on a
    database that does not support it. Since we can't enforce that
    uniqueness on the partial data, we should not add it at all, since
    otherwise users would be blocked from creating certain records. Or we
    would not be able to create the index if offending records would
    already exist.
@@ -58,7 +58,11 @@ def add_index_options(table_name, column_name, options = {}) #:nodoc:
options.assert_valid_keys(:unique, :order, :name, :where, :length, :internal, :using, :algorithm, :type, :opclasses)
index_type = options[:unique] ? "UNIQUE" : ""
# MySQL doesn't support partial indexes, so don't create the index as a
# unique one if the database does not support it.
unique = options[:unique] && (supports_partial_index? || options[:where].empty?)
index_type = unique ? "UNIQUE" : ""
index_type = options[:type].to_s if options.key?(:type)
index_name = options[:name].to_s if options.key?(:name)
max_index_length = options.fetch(:internal, false) ? index_name_length : allowed_index_name_length
Loading