Problem
mac_track_sites has only a primary key on site_id, so duplicate site names—including duplicate Default rows—are structurally possible. The Default-site repair in #357 uses a database-scoped advisory lock and a conditional insert, which is safe on a single database server but is not a substitute for a unique constraint in proxied or multi-primary deployments.
Adding a unique index directly in the 1.2 release fix is unsafe because existing installations may already contain duplicate custom or Default names and their references must be reconciled deliberately.
Required validation
- Reproduce upgrades containing duplicate Default and duplicate custom site names.
- Define deterministic merge/rename behavior without losing device relationships or operator-authored metadata.
- Add a guarded, restartable uniqueness migration for MariaDB and MySQL.
- Verify new installs and upgrades end with an equivalent unique constraint.
- Exercise concurrent creation without relying on connection-scoped advisory locks.
- Treat duplicate-key outcomes as a satisfied postcondition when another writer wins.
Relationships
Found during review of #357. Coordinate with the broader schema work in #104 and the legacy migration defect in #359.
Problem
mac_track_siteshas only a primary key onsite_id, so duplicate site names—including duplicateDefaultrows—are structurally possible. The Default-site repair in #357 uses a database-scoped advisory lock and a conditional insert, which is safe on a single database server but is not a substitute for a unique constraint in proxied or multi-primary deployments.Adding a unique index directly in the 1.2 release fix is unsafe because existing installations may already contain duplicate custom or Default names and their references must be reconciled deliberately.
Required validation
Relationships
Found during review of #357. Coordinate with the broader schema work in #104 and the legacy migration defect in #359.