我想从CICD管道导入hasura元数据。我已经尝试使用Cli-migrations-v2镜像。当它试图导入元数据时,我得到了以下错误。
... level=fatal msg="failed to apply metadata: cannot apply metadata on the database: [parse-failed] expected 1 or 2, encountered 0 ($[1].version)"
我使用的命令如下
sudo docker run -d -p 8080:8080 --net=host --name=hasura-metadata-v2 -v /home/hasura_migrations/metadata:/hasura-metadata -e HASURA_GRAPHQL_DATABASE_URL=postgres://hasurauser:hasurauser@localhost:5432/new_db_migration -e HASURA_GRAPHQL_ENABLE_CONSOLE=true hasura/graphql-engine:v1.2.1.cli-migrations-v2
这和hasura文档中提到的一样。https:/hasura.iodocs1.0graphqlmanualmigrationsadvancedauto-apply-migrations.html#auto-apply-migrations。
似乎当你升级你的项目使用config-v2的时候,有一个 version.yaml
创立于 /home/hasura_migrations/metadata
路径。您文件中的版本似乎是 0
. 只要更新到 2
使用config-v2再试一次。
预期的内容。
~$ cat /home/hasura_migrations/metadata/version.yaml
version: 2
它为我工作。