Files
story/migrations/000037_firmware_incomplete_recovery.up.sql
T

14 lines
484 B
PL/PgSQL

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;