Laravel Fatal Error Class Not Found when migrating

后端 未结 11 2231
后悔当初
后悔当初 2021-02-02 11:39
  1. I\'ve run artisan migrate:reset.

  2. I\'ve deleted some of my migration files because I didn\'t need these tables anymore.

  3. I

11条回答
  •  情深已故
    2021-02-02 11:54

    I ran into this aswell and the solution was different to all of the above. The reason it was failing was because the filename was still mentioned in the migrations table of the DB. Because there were no unique columns I couldn't remove it with PHPMyAdmin and had to tak the CLI route.

    Login to your server as root. Type the following:

    mysql -p database_name
    

    (it now prompts for your password. From here on out everything is preceded with mysql > which just means that you're in the Mysql environment.

    select * from migrations;
    

    Look for the migration file you removed and copy the name.

    delete from migrations where migration = '2015_07_21_000119_create_some_table';
    

    It should mention something about 1 row affected. Now verify that it's gone by typing the first command again:

    select * from migrations;
    

    If it's gone exit the Mysql environment by typing

    exit;
    

    Now try 'php artisan migrate:rollback' again and it should work like a charm :-)

提交回复
热议问题