discourse/db/migrate/20210308195916_add_unique_index_to_invited_groups.rb
Dan Ungureanu fecf3e20d9
FEATURE: Various improvements to invite system (#12314)
* FEATURE: Do not delete invite if link was copied

* FIX: Show error to user if invite redeeming fails

The error was only displayed to console.

* UX: Better placement of bulk buttons

Destroy all expired invites should be on the expired tab, not pending.

* FIX: Ensure invited_groups is unique per invite and group

* FIX: Do not refresh topic list if title unchanged

* FIX: Do not close modal on enter

This intereferes with the group and topic chooser.
Wrapping everything in a form disables this behavior.

* FIX: Move link and email options outside advanced section

* FIX: Do not close modal if saving a link invite

User may still want to copy the link.
2021-03-09 00:15:14 +02:00

16 lines
380 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, [:group_id, :invite_id], unique: true
end
end