Home > Net >  Where Does Prisma save records in PostgreSQL database?
Where Does Prisma save records in PostgreSQL database?

Time:12-31

I started using prisma and noticed that while accessing the database directly I can not see the records that I put earlier into the table using prisma ORM. psql simply tells me that relation does not exists

   nest=# select * from Test;
    ERROR:  relation "test" does not exist
    LINE 1: select * from Test;

here are the tables and sequences

nest=# \d
                 List of relations
 Schema |        Name        |   Type   |  Owner
-------- -------------------- ---------- ----------
 public | Test               | table    | postgres
 public | Test_id_seq        | sequence | postgres
 public | User               | table    | postgres
 public | User_id_seq        | sequence | postgres
 public | _prisma_migrations | table    | postgres
(5 rows)

But while using prisma studio all of my records are accessible and I don't understand how it is possible

CodePudding user response:

Run the query as SELECT * FROM "Test". The quotes are very important here, because Postgres by default will make anything that's not quoted lowercase. Because your table is named Test, you will have to always have the table written as "Test" in your queries

  • Related