why laravel schema reply
[Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1005 Can't create table
test.#sql-13cc_d0(errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter tablecitiesadd constrai ntcities_provinces_id_foreignforeign key (provinces_id) referencesprovinces(id) on delete cascade)[PDOException] SQLSTATE[HY000]: General error: 1005 Can't create table
test.#sql-13cc_d0(errno: 150 "Foreign key constraint is incorrectly formed")
first table
Schema::create('provinces', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->boolean('is_enable');
$table->boolean('is_deletable');
$table->boolean('is_editable');
$table->boolean('deleted');
$table->timestamps();
});
second table
Schema::create('cities', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('province_id')->unsigned()->index();
$table->boolean('is_enable');
$table->boolean('is_deletable');
$table->boolean('is_editable');
$table->boolean('deleted');
$table->timestamps();
$table->foreign('province_id')
->references('id')->on('provinces')
->onDelete('cascade');
});