How to Implement an Optional One-to-One Relationship in Prisma with MongoDB?
Context
I'm using Prisma 5.10.2 with MongoDB and attempting to set up an optional one-to-one relationship between two models based on the official Prisma documentation. However, I've encountered a problem with MongoDB's support for nullable unique fields.
Models...
SOLVED: Create w/ sub create: Subquery returned more than 1 value
Per the documentation, I'm fairly certain I'm using this correctly. However, I'm getting the following error. We are on MSSQL and Prisma 5.11.0
``
"PrismaClientUnknownRequestError:
Invalid prisma.testimonials.create()` invocation:...
SQLite Timeout issues
I am having issues with Prisma + Sqlite.
Essentially I believe Prisma isn't setting sqlite busy_timeout or something.
There is a long history with this issue, see here
...
Returning the next day closest to NOW
So I have a list of dates, and im trying to return the next date that is closest to
new Date.now();
Here is the code:
```ts
const course = await db.course.findFirst({...prisma nested fields
is it okay in terms of performance to have many nested fields in prisma?
```
const user = await prismadb.user.findUnique({
where: { id },
include: {...
Get the next date with prisma
```ts
const course = await db.course.findFirst({
where: {
slug: params.slug,
},...
P3005 Error running Prisma migrate
I am working on a NextJS project that uses prisma. I was able to define my initial schemas and deploy my initial migrations successfully. I made a small change in the diff screenshot attached to this message and I am able to run
npx run db push with no issues. When I try to run npx prisma migrate dev to generate a migration, I get the following error:
```
Error: P3005
...
i want a field to be an array in my mysql schema
I've created my model but in the image field I want it to be an array, so I can insert many images. Is there a solution?
generator client {
provider = "prisma-client-js"
}...
Wierd type error with prisma codegen
29.01 qrtag:build: ./prisma/client/runtime/edge-esm.js:1:1
29.01 qrtag:build: Type error: Declaration emit for this file requires using private name 'i'. An explicit type annotation may unblock declaration emit.
29.01 qrtag:build: ./prisma/client/runtime/edge-esm.js:1:1
29.01 qrtag:build: Type error: Declaration emit for this file requires using private name 'i'. An explicit type annotation may unblock declaration emit.
why that not work?
Code:
```ts
await prisma.pedOutfitFolder.upsert({
where: { userId: this.db.id, name: 'root' },
update: {},...

Sorting by related field
Hey guys 🙂
I have a relation like: Ingredient(translation: IngredientTranslation[]) -> IngredientTranslation (name, langId.. ) (image 1)
Is there a way to sort the ingredients by name? Since i get only _count on the translation field (img 2)...

When to run migrations
Hi! I'm a bit unsure as to when is the best time to run database migrations when deploying new versions of an app, and would love to hear your opinions. Many suggest to run migrations as part of the deploy step during CI/CD, but my concern is that there'll be a window of time where to database has been updated, but the new code hasn't been deployed yet. How do people deal with this? Or do some of you run migrations before starting the web server instead?
Paying for this service but can't login. On multiple accounts now
As the title says. I keep running into these callback errors or whatever this is.
I need to access my accelerate dashboard....

Monorepo setup: Prisma with NestJS
I currently have a postgres database that uses row level security. This database is used by two services that are built with NestJS.
- auth service
- core service
...
Update nested field in composite types
I have a deeply nested structure. It has to be this way.
I want to update a single field at the end of the nested tree structure. How do I accomplish this?...
How to use enum?
I'm using Next.js and TypeScript for my project, but I'm getting an error when I attempt to call prisma create.
Error: Type 'string' is not assignable to type 'Status | undefined'.ts(2322)
```tsx
// page.tsx
const [name, setName] = useState('');...Turbo setup with prisma and pnpm
I have a setup using turborepo and running a few apps and some shared packages together and it works well in dev but i can't figure out how to setup docker, pnpm and prisma together. I've written my dockerfile below and my tree structure is
Prisma;
/apps/qrtag/prisma/prisma.schema
...
Prisma new field adding will thorw the unkown error
```sql
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String @unique
hashedPassword String...
Check constraint migration fails with syntax error
I made the following migration file and ran the migration:
```sql
ALTER TABLE "api_owner"
ADD CONSTRAINT "check_owner_one_null" CHECK (user_id IS NOT NULL AND organization_id IS NULL) OR (user_id IS NULL AND organization_id IS NOT NULL);...