i have letter's model and this model has 2 forign key from attachments and contacts
public function up()
{
Schema::create('letters', function (Blueprint $table) {
$table->increments('id');
$table->integer('contact_id')->unsigned();
$table->integer('attachment_id')->unsigned();
$table->timestamps();
$table->foreign('contact_id')->references('id')->on('contacts');
$table->foreign('attachment_id')->references('id')->on('attachments');
});
}
i do this. but when i type artisan migration SQL has error
General error: 1005 Can't create table ss
.#sql-1064_4a
(errno: 150 "Foreign
key constraint is incorrectly formed") (SQL: alter table letters
add constraint letters_attach
foreign key (
ment_id_foreignattachment_id
) references attachments
(id
))
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kgAL08
via IFTTT
Aucun commentaire:
Enregistrer un commentaire