```ruby
class AddingIndexToSequenceNumbers < ActiveRecord::Migration
  def self.up
    add_index :merge_requests, :sequence_number
  end

  def self.down
    remove_index :merge_requests, :sequence_number
  end
end
```

Make the index on sequence number unique for each target_repository_id
user
```ruby
class AddingIndexToSequenceNumbers < ActiveRecord::Migration
  def self.up
    add_index :merge_requests, [:sequence_number, :target_repository_id], :unique => true
  end

  def self.down
    remove_index :merge_requests, :sequence_number
  end
end
```
assistant