-- Add new type to contact enum
-- Use mastodon for web auth
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_type t
INNER JOIN pg_namespace p ON t.typnamespace=p.oid
INNER JOIN pg_enum e ON e.enumtypid = t.oid
WHERE t.typname='contact_protocol' AND p.nspname='auth' AND e.enumlabel = 'mastodon'
) THEN
auth.contact_protocol ADD VALUE 'mastodon';
END IF;
END
$$;