Amarsh
Amarsh

Reputation: 11804

Prisma how to look into the database

I have followed https://www.prisma.io/docs/get-started/01-setting-up-prisma-new-database-JAVASCRIPT-a002 and gotten it to work. I can see the following:

How do I see in which database/table is prisma saving my data in, and how do I connect to it?

Upvotes: 3

Views: 4129

Answers (3)

akash maurya
akash maurya

Reputation: 656

you can type: psql postgresql://user:password@host:5432/postgresdb

user = username you have used in dockerfile

password = password you have used

host = your host URL postgresdb = your postgres db name from dockerfile

Upvotes: 0

Alan
Alan

Reputation: 10145

I am using odcker to open MySQL: docker exec -it server_mysql_1 mysql -u root --host 127.0.0.1 --port 3306 --password=prisma

Of course, use your own settings!

Upvotes: 0

Harshit Pant
Harshit Pant

Reputation: 498

Prisma doesn't store data in the public schema by default. It stores it in an schema derived from your service name (default$default is the default when no service and stage is provided in the endpoint).

You can do the follow steps to see the underlying data:

  1. Grab the docker container id using docker ps
  2. Run docker exec -it <POSTGRES_CONTAINER_ID> psql -U prisma
  3. List all the schemas using \dn to grab all schemas, and find the schema that your service is using(it is default$default by default)
  4. Now run SET search_path to <YOUR_SCHEMA_NAME_FROM_STEP_3>; to change the default search path
  5. Run \dt to list all tables. You can also run any SQL command now on that schema.

Upvotes: 4

Related Questions