Skip to content

Commit

Permalink
chore: upload supabase migration (#389)
Browse files Browse the repository at this point in the history
- 更新函数
  • Loading branch information
RaoHai authored Sep 13, 2024
2 parents 58de1d7 + 2dc9bb7 commit edf978e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions migrations/supabase/migrations/20240913114522_remote_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
alter table "public"."bots" alter column "token_id" set default ''::text;

set check_function_bodies = off;

CREATE OR REPLACE FUNCTION public.get_bot_stats(filter_bot_id text)
RETURNS TABLE(call_cnt bigint)
LANGUAGE plpgsql
AS $function$
BEGIN
RETURN QUERY
SELECT
COUNT(1)::BIGINT AS call_cnt
FROM user_token_usage u
WHERE u.bot_id = filter_bot_id -- 使用别名来引用参数
GROUP BY u.bot_id;
END;
$function$
;


0 comments on commit edf978e

Please sign in to comment.