Hey, need help with this. I'm trying to link the foreign key from "desas" table to the primary key of "kecamatans" table. But I encountered "foreign key is incorrectly formed" error. I don't know what's causing this. Is my foreign key correct?
"desas" table:
public function up()
{
Schema::create('desas', function (Blueprint $table) {
$table->unsignedBigInteger('id', false);
$table->primary('id');
$table->string('nama_desa');
$table->foreignId('kecamatan_id')->constrained()->onDelete('cascade');
$table->timestamps();
});
}
"kecamatans" table:
public function up()
{
Schema::create('kecamatans', function (Blueprint $table) {
$table->unsignedBigInteger('id', false);
$table->primary('id');
$table->string('nama_kecamatan');
$table->foreignId('kabupaten_id')->constrained()->onDelete('cascade');
$table->timestamps();
});
}
EDIT: Changed the foreign key type of "kecamatans" from "foreign" to "foreignId". Still have the same error