-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row #1639
Comments
The SQL error suggests that you have a 0 value for a permission Why do your Role and Permission models not extend the Spatie model? or at least implement the contract? |
@drbyte I had a work around for this, I let role and permission tables to use default increment ids (as I don't have that many roles or permissions) but I've changed model_id columns to accept Thanks. |
You can change role & permission using UUID, following this steps:
Optional (You can use your own UUID trait):
Now you can use uuid on your |
When I try to seed my roles and permissions I am getting this error:
What I've done
role_has_permissions
table and it was working (accepting uuid's)'model_morph_key' => 'model_id',
and'model_morph_key' => 'model_uuid',
Code
1
seeder
2
Adding models
Any idea why I still get migrate error while table columns are accepting UUID?
The text was updated successfully, but these errors were encountered: