Hasura折腾笔记

Hasura折腾笔记

如何横向拓展

docs: guide on horizontal scaling & auto-scaling · Issue #1183 · hasura/graphql-engine
Guide on horizontally scaling Hasura, setting up auto-scale and benchmarking how fast auto-scale works on a substrate like GKE.

创建自定义function

CREATE FUNCTION npmvs.lucky_packages(num int)
RETURNS SETOF npmvs.package AS $$
  select * from npmvs.package order by random() limit num
$$ LANGUAGE sql STABLE;

字段无法删除的可能

  • 在权限中配置了该字段

本地调试服务器

docker run --name some-postgres -d -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -d postgres
docker run -d -p 8080:8080 --name hasura-server \\
  -e HASURA_GRAPHQL_DATABASE_URL="postgres://postgres:mysecretpassword@192.168.215.2:5432/postgres" \\
  -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \\
  -e HASURA_GRAPHQL_DEV_MODE=true \\
  -e HASURA_GRAPHQL_LOG_LEVEL=debug \\
  -e HASURA_GRAPHQL_ADMIN_SECRET=pbWht7xAbLkLV2cT
  hasura/graphql-engine:v2.42.0