マスターテーブル POll
public function up()
{
Schema::create('poll', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('poll_question', 255);
$table->boolean('status',1)->default(0)->index();
$table->unsignedInteger('order');
});
}
詳細表
public function up()
{
Schema::create('poll_option', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('poll_id');
$table->string('poll_option', 255);
$table->unsignedInteger('vote_poll_option');
$table->unsignedInteger('order');
$table->boolean('status',1)->default(0)->index();
$table->foreign('poll_id')->references('id')->on('poll')->onUpdate('cascade')->onDelete('cascade');
});
}
外部キーでphp artisanを実行すると
SQLSTATE[HY000]: 一般エラー: 1005 テーブルを作成できません
mydb
。#sql-6f4_433
(エラー番号: 150 "外部キー制約の形式が正しくありません")
注:私はすでにlaravel 5.2とmysqlタイプを使用していますInnodbが正しく形成されない主な原因は何ですか