Unable to run migration with `docker-compose` in
See original GitHub issueBug 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:
- Created 2 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
So I find out the issue. For some reason I need to pass my system root user to the
DATABASE_URL
so instead ofDATABASE_URL=postgresql://user:example@localhost:5432/postgres?schema=public&connection_limit=250&pool_timeout=0
must be usedDATABASE_URL=postgresql://[MY_ROOT_USER]:example@localhost:5432/postgres?schema=public&connection_limit=250&pool_timeout=0