P
Prisma7mo ago
kngs

Foreign key constraint failed on the field: `anime_season_fkey (index)`

Getting this error when I try to create a new db entry in prisma, no clue why. Using Postgres rismaClientKnownRequestError: Invalid prisma.anime.create() invocation: Foreign key constraint failed on the field: anime_season_fkey (index)
No description
No description
5 Replies
jonfanz
jonfanz7mo ago
Generally that means that you are inserting a record (anime.create) that can’t find a related record (seasons). Is dataObject.season ever null or undefined? Does the seasons with that seasonYear always exist?
kngs
kngsOP7mo ago
yeah it does. prisma generates the
Seasons
Seasons
model correctly but not the Anime model. also i moved the creation of
seasons
seasons
above the
anime
anime
model but still same issue
No description
kngs
kngsOP7mo ago
im not sure if im approaching this correctly in the first place. After i create all my models (season/anime). I want to be able to query my season model with "find" and then access all the anime under that season model
@Dex_davi
@Dex_davi7mo ago
I think your bug is cause by primary key
kngs
kngsOP7mo ago
what is primary key?
Want results from more Discord servers?
Add your server