LoginSignup
13
12

More than 5 years have passed since last update.

Laravelのmigrate:reset時に謎エラーが出た時の対処

Posted at

app/database/migratinosの中身を色々といじくってたらmigrate:reset時に以下の様なエラーが出ました。

  [Illuminate\Database\QueryException]                                                                                       
  SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'hoge' (SQL: drop table `hoge`)

お馴染みのcomposer dump-autoloadなどなどやってみたり、migrationファイルを消してやり直しても以下の様なエラーが出たりで全く解決せず・・・

{"error":    {"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'CreateHoge' not found","file":"\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Migrations\/Migrator.php","line":297}}

なんじゃこりゃー!となったけども意外な方法で解決

  • データベースのmigrationsテーブルの中身を削除する
  • migrate:refreshを実行

まさかmigrationsテーブルがこんなエラーを引き起こすなんて・・・

13
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
12