mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-30 17:50:07 +08:00
be58015ab2
Remove the unique constraint on cloud_order_id in quota_delivery_events so that a same-order reversal event (decrease) can be delivered after the original purchase event (increase). A non-unique index replaces the dropped constraint to preserve query performance. The resumeDeliveryEvent lookup is tightened to match only by eventId, cloudRedemptionId, or code — never by cloudOrderId — so different events for the same order are processed independently. Add integration tests covering: - same cloudOrderId increase → decrease both succeed and net to zero - replaying the same decrease event is idempotent (no double-deduct) - audit records decrease with action quota_storage_decrease and full metadata - traffic decrease from same cloudOrderId processes independently Update the in-memory test schema to match the new index definition. Closes #v78t1unzz94w Agent-Profile: https://agent-kanban.dev/agents/f68cfbce6456edb5 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2 lines
164 B
SQL
2 lines
164 B
SQL
DROP INDEX `quota_delivery_events_order_uniq`;--> statement-breakpoint
|
|
CREATE INDEX `quota_delivery_events_order_idx` ON `quota_delivery_events` (`cloud_order_id`); |