New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Postgres Single Quote Escaping Breaking Migrations #12095
Comments
Wondering about any updates on this? |
I can reproduce this:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Foo {
id Int @id
bar Json? @default("{\"message\": \"This message includes a quote: Here''s it!\"}")
} Run
The migration that was generated: -- CreateTable
CREATE TABLE "Foo" (
"id" INTEGER NOT NULL,
"bar" JSONB DEFAULT '{"message": "This message includes a quote: Here\'\'s it!"}',
CONSTRAINT "Foo_pkey" PRIMARY KEY ("id")
); Can you share the original SQL of the table that includes |
Update: I assumed that the original table should say
When you create a new row of that table, you get a |
Thank you, this is the correct assumption and the correct bug. Thank you for looking into it. |
Bump on this. |
Another bump here. We could really use this for our migrations. Also, workarounds are acceptable. |
...by the combination of the new postgres default parsing code from the scalar list defaults work and the new string literal code in PSL. closes prisma/prisma#12095
...by the combination of the new postgres default parsing code from the scalar list defaults work and the new string literal code in PSL. closes prisma/prisma#12095
...by the combination of the new postgres default parsing code from the scalar list defaults work and the new string literal code in PSL. closes prisma/prisma#12095
Bug description
Prisma Migrate does not handle double single quotes ('') in a schema. This is an issues because Postgres uses double single quotes ('') to escape a single quote (') in a JSONB default.
How to reproduce
npx prisma migrate dev --name init
Expected behavior
The migration to successfully apply.
Prisma information
The line breaking the migration:
The error given:
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: