-- name: AddProviderOperation :exec
INSERT INTO core.provider_operations (provider, operation)
VALUES ($1, $2)
ON CONFLICT (provider, operation) DO NOTHING;

-- name: ListProviderOperations :many
SELECT operation FROM core.provider_operations
WHERE provider = $1 ORDER BY operation;

-- name: ListAllProviderOperations :many
SELECT provider, operation FROM core.provider_operations
ORDER BY provider, operation;

-- name: DeleteProviderOperationsNotIn :exec
-- Boot reconciliation: drop operations a provider no longer declares.
DELETE FROM core.provider_operations
WHERE provider = $1 AND operation <> ALL(@operations::text[]);
