Sha256: 94ebf2629e66bf8ff74055b893ec3416e187f05b2d9675f67e28b44c6025d2d8
Contents?: true
Size: 425 Bytes
Versions: 17
Compression:
Stored size: 425 Bytes
Contents
class RequiredPullRequestsToBeUniqueByProjectAndNumber < ActiveRecord::Migration def up while (ids = select_values("select max(id) from pull_requests group by project_id, number having count(id) > 1")).any? Github::PullRequest.where(id: ids).delete_all end add_index :pull_requests, [:project_id, :number], unique: true end def down remove_index :pull_requests, [:project_id, :number] end end
Version data entries
17 entries across 17 versions & 1 rubygems