Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: hasura migrate status fails when no hdb_catalog exists on a config v2 project #8925

Open
BenoitRanque opened this issue Sep 5, 2022 · 0 comments
Assignees
Labels
c/cli Related to CLI k/bug Something isn't working t/product-platform

Comments

@BenoitRanque
Copy link
Contributor

Version Information

Server Version: 2.10.1
CLI Version (for CLI related issue): 2.10.1

Environment

OSS

What is the current behaviour?

When running hasura migrate status from a config v2 directory, hasura attempts to create the hdb_catalog.schema_migrations table if it does not exist.

This fails if the hdb_catalog schema does not exist.

This issue may affect all hasura migrate commands.

What is the expected behaviour?

The hdb_catalog schema should be created when required if it does not exist.

How to reproduce the issue?

  1. Bring up a config v2 compatible HGE instance with a separate metadata db and user db
sample docker-compose.yaml
version: "3.8"
services:
  postgres:
    image: postgres:14
    expose:
      - 5432
    volumes:
      - postgres-data:/var/lib/postgresql/data
      - ./postgres/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
    environment:
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
      POSTGRES_USER: ${POSTGRES_USERNAME:-postgres}
      POSTGRES_DB: metadata

  graphql-engine:
    restart: always
    image: hasura/graphql-engine:v2.10.1
    ports:
      - "8080:8080"
    depends_on:
      - postgres
    environment:
      HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://${POSTGRES_USERNAME:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/metadata
      HASURA_GRAPHQL_DATABASE_URL: postgres://${POSTGRES_USERNAME:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/postgres
      HASURA_GRAPHQL_ENABLE_CONSOLE: "true"
      HASURA_GRAPHQL_DEV_MODE: "true"
      HASURA_GRAPHQL_ENABLED_LOG_TYPES: startup, http-log, webhook-log, websocket-log, query-log
  1. Create a config v2 metadata and migrations directory
hasura init --version 2
  1. Attempt to read the migration state
hasura migrate status
  1. An error is thrown because the hdb_catalog schema does not exist in the postgres database

Any possible solutions?

Users can easily work around this by creating the hdb_catalog schema in their user database:

CREATE SCHEMA hdb_catalog;

However, we'd strongly encourage users to migrate to config v3 instead.

@BenoitRanque BenoitRanque added k/bug Something isn't working c/cli Related to CLI labels Sep 5, 2022
@manasag manasag self-assigned this Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/cli Related to CLI k/bug Something isn't working t/product-platform
Projects
None yet
Development

No branches or pull requests

2 participants