prisma / blogr-nextjs-prisma

111 stars 83 forks source link

Error: insert or update on table "Post" violates foreign key constraint "Post_authorId_fkey" #33

Closed jamborski-dev closed 10 months ago

jamborski-dev commented 10 months ago
Error: insert or update on table "Post" violates foreign key constraint "Post_authorId_fkey"
   0: sql_schema_connector::apply_migration::migration_step
           with step=AddForeignKey { foreign_key_id: ForeignKeyId(0) }
             at schema-engine/connectors/sql-schema-connector/src/apply_migration.rs:21
   1: sql_schema_connector::apply_migration::apply_migration
             at schema-engine/connectors/sql-schema-connector/src/apply_migration.rs:10
   2: schema_core::state::SchemaPush
             at schema-engine/core/src/state.rs:436

This happened after migration on step prior to integrating NextAuth. Up until this point had to update these: react@18, react-dom@18, next@13 to be able to install adapter for next-auth.

When run prisma db push all the tables has been created, however the error keeps showing up.

jamborski-dev commented 10 months ago

silly of me.. I forgot to run npx prisma generate after changing the schema.