Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/models/invitation_log_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ class InvitationLogEntry < ApplicationRecord
belongs_to :invitation_log
belongs_to :member
belongs_to :invitation, polymorphic: true, optional: true

validates :member_id, uniqueness: { scope: %i[invitation_type invitation_id] }, allow_nil: true
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class RemoveGlobalUniqueConstraintFromInvitationLogEntries < ActiveRecord::Migration[8.1]
def up
remove_index :invitation_log_entries,
name: 'idx_on_invitation_type_invitation_id_6d6ef495e6'
end

def down
add_index :invitation_log_entries,
%i[invitation_type invitation_id],
name: 'idx_on_invitation_type_invitation_id_6d6ef495e6',
unique: true
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[8.1].define(version: 2026_04_08_220120) do
ActiveRecord::Schema[8.1].define(version: 2026_04_10_174346) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"

Expand Down Expand Up @@ -299,7 +299,6 @@
t.datetime "updated_at", null: false
t.index ["invitation_log_id", "status"], name: "index_invitation_log_entries_on_invitation_log_id_and_status"
t.index ["invitation_log_id"], name: "index_invitation_log_entries_on_invitation_log_id"
t.index ["invitation_type", "invitation_id"], name: "idx_on_invitation_type_invitation_id_6d6ef495e6", unique: true
t.index ["invitation_type", "invitation_id"], name: "index_invitation_log_entries_on_invitation"
t.index ["member_id", "processed_at"], name: "index_invitation_log_entries_on_member_id_and_processed_at"
t.index ["member_id"], name: "index_invitation_log_entries_on_member_id"
Expand Down
8 changes: 0 additions & 8 deletions spec/models/invitation_log_entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,4 @@
})
end
end

describe 'validations' do
it 'validates uniqueness of member_id scoped to invitation' do
entry = Fabricate(:invitation_log_entry)
expect(entry).to validate_uniqueness_of(:member_id)
.scoped_to(:invitation_type, :invitation_id)
end
end
end