So I am busy with making this migration and afther a ton of research, he still gives me the following error message:
SQLSTATE[HY000]: General error: 1005 Can't create table
dev
.bindings
(errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter tablebindings
add constraintbindings_users_id_foreign
foreign key (users_id
) referencesusers
(id
) on delete cascade on update cascade)
Code:
Schema::create('bindings', function (Blueprint $table) {
$table->unsignedInteger('users_id');
$table->foreign('users_id')
->references('id')->on('users')
->onDelete('cascade')
->onUpdate('cascade');
});
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
});
Versions:
PHP: v7.3
Laravel: v5.8.4
MariaDB: v10.3.13
Homestead: v8.1.0
As that I am aware, this should form a foreign key correctly. Any help would be appriciated!