canvas-lms/db/migrate/20160309135747_add_unique_i...

13 lines
374 B
Ruby

class AddUniqueIndexToGroupMemberships < ActiveRecord::Migration
tag :postdeploy
def up
DataFixup::RemoveDuplicateGroupMemberships.run
add_index :group_memberships, [:group_id, :user_id], :unique => true, :algorithm => :concurrently, :where => "workflow_state <> 'deleted'"
end
def down
remove_index :group_memberships, [:group_id, :user_id]
end
end