When using Prisma Studio is used to save Markdown Content into a String field (DataSource = MySQL), it appears that Newlines, Tabs, and possibly other spaces are trimmed, which results in a loss of markdown formatting when the content is retrieved from database.
Before: User Submitted Content (Example)
## Heading
Paragraph
After: Prisma Content Saved
## Heading
Paragraph
How to reproduce
This Assumes there is a working Project with Next.js and Prisma ORM, and a Database Model that utilizes a Text field with rich content such as HTML or Markdown.
Launch Prisma Studio (npx prisma studio)
Edit a content field with Markdown Content
Save Changes to DB
Retrieve Markdown Content from DB
Parse Markdown Content
Notice content formatting and render is incorrect
Expected behavior
Prisma Studio should honor Newlines, Tabs, spaces and possibly other characters for rich content stored in Text or String based fields. The Studio UI could support both a Plain-Text and Rich-Text mode editor so edited content is preserved exactly as entered.
Prisma information
model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
published Boolean @default(false)
title String @db.VarChar(255)
slug String? @unique @db.VarChar(255)
content String? @db.Text
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}
const post = await prisma.post.findUnique({
where: {
slug: slug
}
})
return {
post
}
// Content in Markdown
// console.log(post.content)
Environment & setup
OS: MacOS
Database: MySQL
Node.js version: v19.2.0
Prisma Version
prisma : 4.6.1
@prisma/client : 4.6.1
Current platform : darwin
Studio : 0.476.0
Bug description
When using Prisma Studio is used to save Markdown Content into a
String
field (DataSource = MySQL), it appears that Newlines, Tabs, and possibly other spaces are trimmed, which results in a loss of markdown formatting when the content is retrieved from database.Before: User Submitted Content (Example)
After: Prisma Content Saved
How to reproduce
This Assumes there is a working Project with Next.js and Prisma ORM, and a Database Model that utilizes a Text field with rich content such as HTML or Markdown.
npx prisma studio
)content
field with Markdown ContentExpected behavior
Prisma Studio should honor Newlines, Tabs, spaces and possibly other characters for rich content stored in
Text
orString
based fields. The Studio UI could support both a Plain-Text and Rich-Text mode editor so edited content is preserved exactly as entered.Prisma information
Environment & setup
Prisma Version