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

relation "migrations" does not exist 2.5.2 & up. #604

Open
Destreyf opened this issue Jun 30, 2021 · 6 comments
Open

relation "migrations" does not exist 2.5.2 & up. #604

Destreyf opened this issue Jun 30, 2021 · 6 comments

Comments

@Destreyf
Copy link

This was already mentioned in #542, however I believe it deserves it's own ticket.

I can upgrade my 2.2.4 all the way up to 2.5.1 without any issue, going to 2.5.2 or higher results in an error message about the "migrations" relation not existing.

Would it be possible for someone to give me the create table sql needed to generate this migrations table?

This appears to originate from the postgres-migrations module, I'm not really sure how to address this beyond this point.

@elitan
Copy link
Contributor

elitan commented Jul 16, 2021

@elitan elitan closed this as completed Jul 16, 2021
@Destreyf
Copy link
Author

@elitan This is not fixed. The error still exists and will not allow me to update past 2.5.1.

@Destreyf
Copy link
Author

Copy of my docker-compose log:

hasura-backend-plus_1  | $ node -r ./dist/start.js
hasura-backend-plus_1  | Applying migrations
hasura-backend-plus_1  | (node:29) UnhandledPromiseRejectionWarning: Error: Migration failed. Reason: relation "migrations" does not exist
hasura-backend-plus_1  |     at /app/node_modules/postgres-migrations/dist/migrate.js:63:27
hasura-backend-plus_1  |     at processTicksAndRejections (internal/process/task_queues.js:95:5)
hasura-backend-plus_1  |     at async /app/node_modules/postgres-migrations/dist/with-lock.js:25:28
hasura-backend-plus_1  |     at async Object.applyMigrations (/app/dist/shared/migrations.js:13:9)
hasura-backend-plus_1  |     at async start (/app/dist/ts-start.js:29:5)
hasura-backend-plus_1  | (Use `node --trace-warnings ...` to show where the warning was created)
hasura-backend-plus_1  | (node:29) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
hasura-backend-plus_1  | (node:29) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
hasura-backend-plus_1  | Done in 1.54s.

@Destreyf
Copy link
Author

My logs from v2.5.1

hasura-backend-plus_1  | yarn run v1.22.5
hasura-backend-plus_1  | $ node -r ./dist/start.js
hasura-backend-plus_1  | Applying migrations
hasura-backend-plus_1  | Finished applying migrations
hasura-backend-plus_1  | Running on port 9001

@elitan
Copy link
Contributor

elitan commented Jul 22, 2021

Do you have a docker-compose.yaml that I could try to reproduce this error on my end?

@elitan elitan reopened this Jul 22, 2021
@Destreyf
Copy link
Author

This is the docker-compose file I'm using

version: '3.9'
services:
  postgres:
    image: postgres:12
    restart: "unless-stopped"
    env_file:
      - ./.env.development
    volumes:
      - db_data:/var/lib/postgresql/data

  adminer:
    image: adminer
    restart: always
    ports:
      - 9999:8080

  graphql:
    image: hasura/graphql-engine:v2.0.3
    ports:
      - '8888:8888'
    depends_on:
      - postgres
      - api
    restart: "unless-stopped"
    env_file:
      - ./.env.development
    command:
      - graphql-engine
      - serve
    volumes:
      - ./apps/hasura/migrations:/hasura-migrations
      - ./apps/hasura/metadata:/hasura-metadata

  hasura-backend-plus:
    image: nhost/hasura-backend-plus:v2.5.1
    ports:
      - '9001:9001'
    depends_on:
      - graphql
      - minio
    restart: "unless-stopped"
    environment:
      PORT: 9001
      HASURA_GRAPHQL_ENDPOINT: http://graphql:8888/v1/graphql
      HASURA_ENDPOINT: http://graphql:8888/v1/graphql
    env_file:
      - ./.env.development
    volumes:
      - ./apps/hasura/custom:/app/custom

  minio:
    image: minio/minio
    restart: "unless-stopped"
    volumes:
      - minio_data:/data
      - minio_config:/.minio
    environment:
      MINIO_ACCESS_KEY: minioaccesskey123123
      MINIO_SECRET_KEY: miniosecretkey123123
    entrypoint: sh
    command: -c 'mkdir -p /data/storage && /usr/bin/minio server --address :9000 /data'
    ports:
      - '9000:9000'

  api:
    image: node:14-buster-slim
    restart: "unless-stopped"
    working_dir: /app/
    volumes:
      - './dist/apps/api:/app'
      - './pacakge.json:/app/package.json'
      - './node_modules:/app/node_modules'
    entrypoint: sh
    command: -c 'cd /app && npm install -g nodemon && nodemon main.js'
    environment:
      - PORT=3333
    ports:
      - '3333:3333'

volumes:
  db_data:
  minio_data:
  minio_config:

Please note that I am using hasura 2.0.3, however this problem existed for me on hasura 1.3.3.

This project originally started on version 2.2.4 of hasura-backend-plus, I originally tried to go straight to 2.6.1, but that failed, so I started back at 2.2.4 and incremented the version number until it failed to start, which happened on version 2.5.2.

It may be the case that I need to restart the schema for hasura-backend-plus to fix this, but that would cause me some headaches around my hasura migrations, so I've been wanting to avoid that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants