-- Nachklang e.V. Feedback module — makes submitting idempotent per form visit. -- Apply manually against the FEEDBACK_DB database, after 002_add_poster_image_url.sql: -- mysql -h -u -p < 003_add_submission_client_token.sql -- -- The form generates one UUID per visit and resends it on every retry. When -- a submission saved but its response never reached the phone, the visitor -- sees an error and taps "absenden" again; the API now finds the stored token -- and answers with the original submission instead of saving a copy. -- -- Unique per event, not globally: one visit can switch to another concert's -- form in the same tab, and that event's submission must still save. -- -- NULL for every row written before this migration and for any client that -- sends no token; a UNIQUE index allows any number of NULLs. ALTER TABLE submissions ADD COLUMN client_token CHAR(36) NULL AFTER ip_hash, ADD UNIQUE KEY uq_sub_event_client_token (event_id, client_token);