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)

5 Replies
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?yeah it does. prisma generates the model correctly but not the Anime model. also i moved the creation of above the model but still same issue

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
I think your bug is cause by primary key
what is primary key?