mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 04:59:22 -06:00
16 lines
379 B
Ruby
16 lines
379 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddUniqueIndexToInvitedGroups < ActiveRecord::Migration[6.0]
|
|
def change
|
|
execute <<~SQL
|
|
DELETE FROM invited_groups a
|
|
USING invited_groups b
|
|
WHERE a.id < b.id
|
|
AND a.invite_id = b.invite_id
|
|
AND a.group_id = b.group_id
|
|
SQL
|
|
|
|
add_index :invited_groups, %i[group_id invite_id], unique: true
|
|
end
|
|
end
|