feat(tickets): attendee columns and codes for paid tickets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-04 16:56:47 +08:00
1 parent a64ba1ad63
commit d56d0c3450
4 files changed
+30 -2

No files matched your search

+6 -1
View File
@@ -615,10 +615,15 @@ CREATE TABLE IF NOT EXISTS `ticket` (
`cancelled_by` varchar(255) NULL,
`checked_in_at` datetime NULL,
`checked_in_by` varchar(255) NULL,
`attendee_named_at` datetime NULL,
`attendee_consent_at` datetime NULL,
`attendee_notice_id` bigint NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_ticket_code` (`code`),
KEY `idx_ticket_type_status` (`ticket_type_id`, `status`),
KEY `idx_ticket_order` (`order_id`)
KEY `idx_ticket_order` (`order_id`),
KEY `idx_ticket_event_mobile` (`event_uuid`, `attendee_mobile_e164`),
KEY `idx_ticket_event_email` (`event_uuid`, `attendee_email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- add-event-ticket-orders/sql/02-event-tickets-module.sql
@@ -0,0 +1,15 @@
-- Co-Lite change add-event-tickets: attendee naming and consent on tickets, and the keys self check-in matches on.
-- Target: `service-counter`. Additive only. Run before the new services-counter starts. Needs a user that may alter tables.
USE `service-counter`;
ALTER TABLE `ticket`
ADD COLUMN `attendee_named_at` datetime NULL COMMENT 'when the buyer last named the attendee',
ADD COLUMN `attendee_consent_at` datetime NULL COMMENT 'when the attendee agreed to be kept updated',
ADD COLUMN `attendee_notice_id` bigint NULL COMMENT 'privacy notice version they agreed to',
ADD KEY `idx_ticket_event_mobile` (`event_uuid`, `attendee_mobile_e164`),
ADD KEY `idx_ticket_event_email` (`event_uuid`, `attendee_email`);
-- Tickets of orders paid before this release get their code now (22 URL-safe characters, like the new ones).
UPDATE `ticket` t JOIN `shop_order` o ON o.id = t.order_id
SET t.code = LEFT(REPLACE(REPLACE(REPLACE(TO_BASE64(RANDOM_BYTES(16)), '+', '-'), '/', '_'), '=', ''), 22)
WHERE o.status = 'PAID' AND t.status = 'ACTIVE' AND t.code IS NULL;
@@ -0,0 +1,8 @@
-- Co-Lite change add-event-tickets: rollback. Drops attendee naming times and consent records. Ticket codes stay (add-event-ticket-orders owns that column).
USE `service-counter`;
ALTER TABLE `ticket`
DROP KEY `idx_ticket_event_mobile`,
DROP KEY `idx_ticket_event_email`,
DROP COLUMN `attendee_named_at`,
DROP COLUMN `attendee_consent_at`,
DROP COLUMN `attendee_notice_id`;
+1 -1
View File
@@ -6,7 +6,7 @@ Design: `design.md` (technical contracts) and `docs/superpowers/specs/2026-12-04
## 1. Data
- [ ] 1.1 Write the SQL:
- [x] 1.1 Write the SQL:
- `sql/01-ticket-attendees.sql`: the three `ticket` columns, the two keys, and codes for active tickets on Paid orders that have none;
- `sql/99-rollback.sql`.