Key not present in table #14673
-
I'm trying to sync my DB and seed it after. I have two tables which is defined like so (according to the docs) Product.hasMany(Sales)
Sales.belongsTo(Product) This seems to work fine as the The problem comes when I try to seed the DB (local development).
To me, the error says that no row in the product has a PK matching productId, so I tried to disable foreign-key checks by doing this SET FOREIGN_KEY_CHECKS = 0 but I get this error instead
Any ideas on how I could get past this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Which database are you using? Isn't FOREIGN_KEY_CHECKS a sqlite config option? |
Beta Was this translation helpful? Give feedback.
Which database are you using? Isn't FOREIGN_KEY_CHECKS a sqlite config option?
I wouldn't recommending disabling them though, you should create the product entry that is being referenced first