hey people, how you doing? so, I have this postgr...
# orm-help
j
hey people, how you doing? so, I have this postgres database but I am completely unable to execute a simple
TRUNCATE TABLE user RESTART IDENTITY CASCADE;
... everytime I try to run that on both
prisma.$queryRaw
and on pgadmin I get the same error: 42601 syntax error at or near to "user"
✅ 1
n
Hey 👋 Welcome to our Slack community! 🙌 Could you try including the schema name as well? For Example if user table is in public schema, could you try passing
TRUNCATE TABLE "public"."user" RESTART IDENTITY CASCADE
in queryRaw?
Does this solve the issue for you?
It seems the issue is resolved, if that’s not the case do let us know.
j
Hi Nurul, I’m really sorry not answering you earlier
indeed your option worked, but for some reason, removing
TABLE
from the query also did work
thank you for your help!!!
n
Ah I see, thanks for getting back Glad to hear that this is resolved 🙌
❤️ 1
j
But just answering you properly, here it is my complete schema:
Copy code
model User {
    id         Int    @id @default(autoincrement())
    name       String
    email      String @unique
    password   String
    posts      Post[] @relation("CreatedBy")
    likedPosts Post[] @relation("LikedBy")
}

model Post {
    id        Int      @id @default(autoincrement())
    text      String
    createdAt DateTime @default(now())
    author    User     @relation("CreatedBy", fields: [authorId], references: [id])
    authorId  Int
    likedBy   User[]   @relation("LikedBy")
}
and the DB URL is
postgresql://joao:12345678@localhost:5432/dev?schema=public
👍 1