Schema::create('tbl_candidatures', function (Blueprint $table) {
$table->increments('id');
$table->timestamp('SubmitDate');
$table->string('cvPath');
$table->string('LettreMotivationPath');
$table->unsignedInteger('id_perso')->index();
$table->foreign('id_perso')->references('id')->on('tbl_compte_personnels');
$table->unsignedInteger('id_aca')->index();
$table->foreign('id_aca')->references('id')->on('tbl_compte_academiques');
$table->unsignedInteger('id_profe')->index();
$table->foreign('id_profe')->references('id')->on('tbl_compte_professionels');
$table->timestamps();
Schema::create('tbl_compte_personnels', function (Blueprint $table) {
$table->increments('id');
$table->string('lName',100);
$table->string('lFame',100);
$table->string('Civilite',50);
$table->date('DateDeNaissance',);
$table->string('PaysDeNaissance');
$table->string('RegionDeNaissance');
$table->string('LieuxDeNaissance');
$table->bigInteger('Age');
$table->string('SituationFamiliate');
$table->string('Adresse');
$table->string('VilleDeResidence');
$table->string('RegionDeResidence');
$table->string('PaysDeResidence');
$table->timestamps();
SQLSTATE[HY000]: General error: 1005 Can’t create table e-recrutementdb.tbl_candidatures (errno: 150 “Foreign key constraint is incorrectly formed
ormed”) (SQL: alter table tbl_candidatures add constraint tbl_candidatures_id_perso_foreign foreign key (id_perso) references tbl_compte_per sonnels (id))
I have already created the database requirements for those foreign keys to work.