support metadata.json in cli-migrations image (close #1947) (#1968)

/scripts/cli-migrations/docker-entrypoint.sh only checks for metadata.yaml, however, https://docs.hasura.io/1.0/graphql/manual/migrations/manage-metadata.html#exporting-hasura-metadata talks about a metadata.json
This commit is contained in:
Aravind Shankar 2019-04-11 09:11:44 +05:30 committed by Shahidh K Muhammed
parent 86192511a4
commit 22656cefbd

View File

@ -54,10 +54,13 @@ if [ -d "$HASURA_GRAPHQL_MIGRATIONS_DIR" ]; then
cd "$TEMP_MIGRATIONS_DIR"
echo "endpoint: http://localhost:$HASURA_GRAPHQL_SERVER_PORT" > config.yaml
hasura-cli migrate apply
# check if metadata.yaml exist and apply
# check if metadata.[yaml|json] exist and apply
if [ -f migrations/metadata.yaml ]; then
log "applying metadata from $HASURA_GRAPHQL_MIGRATIONS_DIR/metadata.yaml"
hasura-cli metadata apply
elif [ -f migrations/metadata.json ]; then
log "applying metadata from $HASURA_GRAPHQL_MIGRATIONS_DIR/metadata.json"
hasura-cli metadata apply
fi
else
log "directory $HASURA_GRAPHQL_MIGRATIONS_DIR does not exist, skipping migrations"