Level 102
Can you show the migration that fails? My best guess is that therapy_idisn't a big integer
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table therapies add constraint therapies_therapy_id_foreign foreign key (therapy_id) references therapy (id))
I have three main tables in migrations: therapies, symptoms and herb, and two pivot tables: therapy_symptom and herb_therapy.
I don't know what is the problem here?
@TikTina the table is called therapies but you reference on('therapy')
$table->foreign('therapy_id')->references('id')->on('therapies');
Please or to participate in this conversation.