Prisma - No destination for column XXXXX #12
-
Hi, Just started using Bob as a replacement to the now unmaintained prisma go lib. Got my files successfully generated from the schema.prisma file, but running into an error I can't figure out. Sample prisma schema:
Code:
Any pointers to where I've gone wrong here? Cheers |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
I was unable to replicate this. Did you make sure that your database is up to date by running your migrations? I tried with this schema: generator db {
provider = "go run -mod=mod github.com/stephenafamo/bob/gen/bobgen-prisma"
output = env("PRISMA_OUTPUT")
}
datasource db {
provider = "sqlite"
url = "file:demo.db"
}
model Business {
id Int @id @default(autoincrement())
name String
description String
slug String @unique
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
setup Boolean @default(false)
}
model User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
businesses Business[]
} After running the migrations with package main
import (
"context"
"fmt"
"playground/prisma/"
"playground/prisma/factory"
"github.com/stephenafamo/bob"
)
func main() {
if err := run(context.Background()); err != nil {
panic(err)
}
}
func run(ctx context.Context) error {
client, err := prisma.New()
if err != nil {
return err
}
defer client.Close()
db := bob.DebugExecutor(client, nil)
_, err = factory.New().NewBusiness().Create(ctx, db)
if err != nil {
return err
}
businesses, err := prisma.Businesses(ctx, db).All()
if err != nil {
return err
}
fmt.Printf("%#v\n", businesses[0])
return nil
} And this was the output:
|
Beta Was this translation helpful? Give feedback.
I was unable to replicate this. Did you make sure that your database is up to date by running your migrations?
I tried with this schema: