question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to run migration with `docker-compose` in

See original GitHub issue

Bug description

First of all, I love Prisma, and thank you for the development of such a great tool. Unfortunately I am unable to make it working with docker-compose locally. I am stuck in the setup prisma guide (https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/relational-databases/using-prisma-migrate-typescript-postgres). Where when I run command npx prisma migrate dev --name init I get response:

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "postgres", schema "public" at "localhost:5432"

Error: P1010: User `user` was denied access on the database `postgres.public`

docker-compose.yml:

services:
  db:
    image: postgres:12
    restart: always
    env_file:
      - ./db/.env
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: 123
    ports:
      - 5432:5432

.env:

DATABASE_URL=postgresql://user:123@localhost:5432/postgres?schema=public&connection_limit=250&pool_timeout=0

How to reproduce

Expected behavior

Prisma information

Environment & setup

Prisma Version

3.10.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
vaclav-stummercommented, Mar 4, 2022

It has correct permission within the docker container (super admin and other required ones). It seems more like some docker issue, for prototyping it should be fine. When I tried to open the roles in the DBeaver it seems the user is not created there for some reason

1reaction
vaclav-stummercommented, Mar 2, 2022

So I find out the issue. For some reason I need to pass my system root user to the DATABASE_URL so instead of DATABASE_URL=postgresql://user:example@localhost:5432/postgres?schema=public&connection_limit=250&pool_timeout=0 must be used DATABASE_URL=postgresql://[MY_ROOT_USER]:example@localhost:5432/postgres?schema=public&connection_limit=250&pool_timeout=0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why am I unable to run django migrations via ... - Stack Overflow
When you ran the second command (migrate), another new container was created. The migration ran, but it had nothing to do. That's because...
Read more >
Docker-compose migrations are not working
Hello! I followed the tutorial and in the Migrating the Database section, I receive a “Could not fetch the movies!” message.
Read more >
Unable to migrate database - Docker Community Forums
Running under windows 10 using powershell. After running docker compose build docker compose up I wish to migrate the database.
Read more >
Docker/Docker-Compose Migrations - Sourcegraph handbook
Prepare the Migration · First, find your local instance's CONTAINER_ID by running your local instance, then executing the command docker ps . ·...
Read more >
Docker container fails to start after upgrading from 14.9.3 to ...
It appears to be related to database migration. Steps to reproduce. I am using gitlab/gitlab-ce:latest . After updating with docker-compose the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found