何かを追加することはできませんし、それがスローされます:私はその移行のすべてを削除し、あるかもしれないものをデバッグするために、唯一つのフィールドを残してきたLaravelは私のマイグレーションファイルで破った外部キー
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint
(SQL: create table `product` (`test` int not null) default character
set utf8mb4 collate utf8mb4_unicode_ci)
ここでの問題、そして今、私にこのエラーを与えているとして、移行です:
public function up()
{
Schema::create('product', function (Blueprint $table) {
$table->integer('test');
});
}
私はcomposer dump-autoload
をやってみましたが、何も変わっていません。
EDIT
vagrant halt
とvagrant up
私はmigrate:fresh
後に取得していた最初のエラーをした後です:
SQLSTATE[23000]: Integrity constraint violation: 1022 Can't write;
duplicate key in table '#sql-4ef_4' (SQL: alter table
`product_shipping_country` add constraint `fk_psc_product` foreign key
(`product_id`) references `product` (`content_id`) on delete CASCADE on
update CASCADE)
しかし、すぐに、私はこのエラーがもはや存在しない、と私はmigrate:fresh
を実行しなかった後、古いものをもう一度入手する
EDIT 2
DBを手動で削除しようとしましたが、同じことが起こります。私はその移行を削除し、その1つの後のすべての移行場合もcomposer clear-cache
とartisan cache:clear
EDIT 3
の両方をクリアし、エラーがなくなったので、私はエラーがその特定の移行であるとしていますか?
foreign-key
私は移行で外部キーを持っていない場合でもエラーが表示されるのですか?