lazyBoy/migrations/027_binding_authorizations.sql

7 lines
376 B
SQL

-- Revoked identifiers remain permanently revoked. Reauthorization allocates a
-- fresh binding; at most one live binding exists for a package and bot.
ALTER TABLE tool_bindings DROP CONSTRAINT tool_bindings_package_row_id_bot_id_key;
CREATE UNIQUE INDEX tool_bindings_live_package_bot
ON tool_bindings(package_row_id, bot_id)
WHERE status IN ('installing', 'ready');