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
EetJeKomu
EetJeKomuOP•3y ago
I heard you can turn of foreign key check but this doesn't really seem like the right way to fix this. Any suggestions?
Jochem
Jochem•3y ago
can you show the full structure of both tables and the foreign key definitions?
EetJeKomu
EetJeKomuOP•3y ago
this should be it man
EetJeKomu
EetJeKomuOP•3y ago
I don't know if this is enough for you?
Jochem
Jochem•3y ago
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?
EetJeKomu
EetJeKomuOP•3y ago
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
Jochem
Jochem•3y ago
no worries 🙂 en veel succes verder!
EetJeKomu
EetJeKomuOP•3y ago
Thanks maat!
Want results from more Discord servers?
Add your server