mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 16:48:45 +08:00
Admins often recreate groups with the same pricing, routing, and account membership. A server-side duplicate creates an inactive copy for review, preserves eligible account priorities, and recovers ambiguous retries without creating extra groups. Constraint: Group has no neutral JSON metadata field for durable operation recovery Constraint: Model routing references account IDs, so copied configuration requires matching bindings Rejected: Rebuild from the list response | it omits configuration and account priority details Rejected: Store operation identity in business configuration | it would pollute real group settings Confidence: high Scope-risk: moderate Reversibility: clean Directive: Keep duplicated groups inactive until an administrator reviews the copied configuration Tested: Go unit and full tests, go vet, integration-tag compile, frontend Vitest, lint, typecheck, production build, and Playwright duplicate flow Not-tested: PostgreSQL container integration locally because Docker is unavailable; CI will execute the database-backed suite
9 lines
422 B
SQL
9 lines
422 B
SQL
-- Persist an internal operation identity for safely recovering an already
|
|
-- committed group duplicate when the idempotency response write is ambiguous.
|
|
ALTER TABLE groups
|
|
ADD COLUMN IF NOT EXISTS duplicate_operation_id VARCHAR(64);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_groups_duplicate_operation_id_active
|
|
ON groups (duplicate_operation_id)
|
|
WHERE duplicate_operation_id IS NOT NULL AND deleted_at IS NULL;
|