Laravelのmigrate:resetで外部キーエラー
Laravelで
php artisan migrate:reset
したら、以下のエラーが出た。外部キー関連のエラー。
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or upda te a parent row: a foreign key constraint fails (SQL: drop table if exists `tags`)
dropする順番間違えていた。先にキーの関連付けテーブル消すべきだった。以下が正しい順番。
public function down() { Schema::dropIfExists('title_tag'); Schema::dropIfExists('tags'); }