DEV Community

Discussion on: Easily use UUIDs in Laravel

Collapse
 
slipperydippery profile image
slipperydippery

Great post, I didn't know that it was so easy! I am running into a problem with my foreign keys:

SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `groups` add constraint `groups_user_id_foreign` foreign key (`user_id`) references `users` (`id`) on delete cascade)

Any idea on what I'm doing wrong?

Collapse
 
nwosucc profile image
Nwosu Cyprian

Check that both groups.user_id and users.id have same type definition e.g if users.id is UNSIGNED Integer, groups.user_id should be same