1 month ago

foreign key problems in user table

Posted 1 month ago by iabrar95

I added a foreign key to my user table when I migrate there is an error occur

SQLSTATE[HY000]: General error: 1005 Can't create table medcare.users (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table users add constrai nt users_doctor_id_foreign foreign key (doctor_id) references doctors (id))

when I checked my database the column has been added but this error occur I am afraid it will not work when I add data to it

Please sign in or create an account to participate in this conversation.