The problem here is that a BigInt is referencing an Int. Change them to BigInt's as well and it should work. Foreign Keys do not require an AI ID.
FWIW, you should migrate step by step. First change them to Bigs, then change them to become AI etc.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Salud, everyone.
I am working within a database that was set up by a php/laravel newbie @ a startup. The person in question has moved on, and its now my job to clean up their naive choices.
Most every table does not use an auto incrementing ID, opting rather for unsigned int values that were statically set in seeders designed to be run in production. (i know, ew). These ID values also tend to very consistently have foreign key constraints that are causing issues when I am going through and trying to bring everything back into line with laravel convention.
I am using the Schema facade to run $table->id()->change() commands on most tables, and the corresponding relations get changed with $table->unsignedBigInteger('whatever_id')->change().
When my migration runs, however, I get General error: 3780 Referencing column 'whatever_id' and referenced column 'id' in foreign key constraint 'table_whatever_id_foreign' are incompatible
Given that they WILL BE compatible once all the operations in my migration run, how can I disable this check? (i am already employing Schema::disableForeignKeyConstraints()) Is my only option to delete and remake the foreign key constraint?
Thx, E
Please or to participate in this conversation.