Dedupe RSVPs and add tests for auto-RSVP on claim
Add migration to clean up duplicate RSVPs (keep earliest per event+name). Add GetRsvpByName and DeleteDuplicateRsvps queries. Tests cover auto-RSVP creation, duplicate prevention, and case-insensitive matching. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -72,6 +72,11 @@ SELECT COUNT(*) FROM rsvps WHERE event_id = ?;
|
||||
-- name: GetRsvpByName :one
|
||||
SELECT * FROM rsvps WHERE event_id = ? AND name = ? COLLATE NOCASE LIMIT 1;
|
||||
|
||||
-- name: DeleteDuplicateRsvps :exec
|
||||
DELETE FROM rsvps WHERE id NOT IN (
|
||||
SELECT MIN(id) FROM rsvps GROUP BY event_id, name COLLATE NOCASE
|
||||
);
|
||||
|
||||
-- name: GetUserByPhone :one
|
||||
SELECT * FROM users WHERE phone = ?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user