I'm trying to use an existing database for another...
# orm-help
a
I'm trying to use an existing database for another application I'm building and I'm getting the following error on entering default$default when prompted for the name of existing schema. You mind assisting me? I'm stuck.
r
@ahebwa49 Whatever database you are using is not running i guess. which database your using ?? and where it is running (local / remote server) ?
a
i believe it's running, locally. I'm actually using docker
check this out
this shows it better
r
where did you run
cli
commands ? inside docker container or host machine ??
I am thinking docker container port is not exposed to host machine
you can see that in result of
docker ps
. if port exported, you would see something like
0.0.0.0:5432->5432/tcp
a
which cli commands are you referring to? You mean for prisma?
like prisma init?
how do i expose the docker container port to the host machine?
i ran prisma init in my application backend. Not inside the docker container.
I'm not sure if i ran it in the host machine. I don't understand it that much
you can teach me more or kindly explain to me
r
@ahebwa49 How do you start your DB ? I mean which
command
?
a
docker-compose up -d
i make sure i'm in the directory with that file
the docker-compose.yml file
r
Are you seeing anything like this in
docker-compose.yml
file
Copy code
ports:
  5432: 5432
a
Copy code
databases:
          default:
            connector: postgres
            host: postgres
            port: 5432
            user: prisma
            password: prisma
            migrations: true
@REDDY PRASAD
r
do you mind sharing whole file ?
a
I don't mind
Copy code
version: "3"

services:
  prisma:
    image: prismagraphql/prisma:1.26
    ports:
      - "4466:4466"
    environment:
      PRISMA_CONFIG: |
        port: 4466
        databases:
          default:
            connector: postgres
            host: postgres
            port: 5432
            user: prisma
            password: prisma
            migrations: true

  postgres:
    image: postgres:10.5
    environment:
      POSTGRES_USER: prisma
      POSTGRES_PASSWORD: prisma
    volumes:
      - postgres:/var/lib/postgresql/data

volumes:
  postgres:
r
Copy code
mongo:
    image: mongo:3.6
    restart: always
    environment:
      MONGO_INITDB_ROOT_USERNAME: prisma
      MONGO_INITDB_ROOT_PASSWORD: prisma
    ports:
      - "27017:27017"
    volumes:
      - mongo:/var/lib/mongo
This is sample for mongodb. You will have similar section for PostgreSQL.
@ahebwa49 Can you replace following in your file ?
Copy code
postgres:
    image: postgres:10.5
    environment:
      POSTGRES_USER: prisma
      POSTGRES_PASSWORD: prisma
    ports:
      - 5432:5432
    volumes:
      - postgres:/var/lib/postgresql/data
a
well i don't have the ports param on my file
r
yes
a
is that all i have to add?
should i add it?
okay, on it
r
As for i know, thats it. Yes , add that
ports
param only
restart services after done
a
@REDDY PRASAD
see this error
r
line should be like
- 5432:5432
a
hey, thanks a lot. I somehow figured it out past this step
@REDDY PRASAD
r
👍