Foreign key is not working.
This is my migration file
Schema::create('course_prospect', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('prospect_id')->length(11)->unsigned();
$table->foreign('prospect_id')->references('id')->on('prospect');
$table->integer('course_id')->length(11)->unsigned();
$table->foreign('course_id')->references('course_id')->on('course');
$table->timestamps();
});
I'm getting this error
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error:
1005 Can't create table `customerinquirydb`.`#sql-104c_e9` (errno: 150
"Foreign key constraint is incorrectly formed") (SQL: alter table
`course_prospect` add constraint `course_prospect_prospect_id_foreign`
foreign key (`prospect_id`) references `prospect` (`id`))
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2uEqCfC
via IFTTT
Aucun commentaire:
Enregistrer un commentaire