DO $$
BEGIN
    IF EXISTS (
        SELECT 1 FROM pg_class
        WHERE oid = to_regclass('agent_model_invocations') AND relkind = 'v'
    ) THEN
        DROP VIEW agent_model_invocations;
    END IF;
END $$;
