I am trying to insert values into my comments table and I am getting a error. Its saying that I can not add or update child row and I have no idea what that means.
m
I had the same error, the problem was that I was trying to add role_id
foreign to the users
table, but role_id
did not have a default value, so the DB did not allow me to insert the column because I already had some users and it didn't know how to add the column to them.
Since I was in development I just used migrate:fresh
, but if I was on production, I would probably set a default value to the role_id
and not make it not constrained until I had the corresponding role on the DB.