Files

14 lines
484 B
PL/PgSQL
Raw Permalink Normal View History

2026-08-26 06:41:07 +08:00
BEGIN;
ALTER TABLE firmware_release
DROP CONSTRAINT firmware_release_version_key;
CREATE UNIQUE INDEX firmware_release_active_version_key
ON firmware_release (tenant_id, model, COALESCE(hardware_revision, ''), version)
WHERE status <> 'RETIRED';
COMMENT ON INDEX firmware_release_active_version_key IS
'Prevents duplicate active firmware manifests while allowing a corrected artifact to reuse the business version after an incomplete release is retired.';
COMMIT;