prisma graphql 集成timescaledb

prisma 官方文档说明了因为支持pg 所以相关的timescaledb、cockroachdb 应该也是支持的
但是测试之后timescaledb 支持cockroachdb有问题(事务处理模型支持有问题)

初始化项目

prisma init app

修改docker-compose file

version: '3'
services:
  prisma:
    image: prismagraphql/prisma:1.13
    ports:
    - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        # uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
        # managementApiSecret: my-secret
        databases:
          default:
            connector: postgres
            host: postgres
            port: 5432
            user: postgres
            migrations: true
  postgres:
    image: timescale/timescaledb-postgis
    ports:
    - "5432:5432"

启动&&deploy

  • 启动docker
cd app
docker-compose up -d
  • deploy schema
prisma deploy

运行效果


参考资料

https://www.prisma.io/
http://www.timescale.com/

posted on 2018-08-11 11:34  荣锋亮  阅读(399)  评论(0编辑  收藏  举报

导航