SQL foreign key constraint fails
I try to insert a new row into a table with the foreign key. But he doesn't want to, I think because he doesn't find the primary key. Though the primary key exists since I just added it.
8 Replies
I heard you can turn of foreign key check but this doesn't really seem like the right way to fix this. Any suggestions?
can you show the full structure of both tables and the foreign key definitions?
this should be it man
I don't know if this is enough for you?
oh! I just noticed rereading the error, you're referencing mydb.events but eventsdb.time_slots, is that intentional?
you're sure you're not inserting into eventsdb.events, and referencing mydb.events in the foreign key for example?
Ooh really, it could be possible that that is the problem
I'm looking into it
We used mySQLworkbench to generate the .sql from a model
I've already noticed it make some small errors sometimes and this is one of them
Thanks for the help
no worries 🙂 en veel succes verder!
Thanks maat!