First I rolled back 2 migrations by mistake, then I ran php artisan migrate
command and I got the following error:
[Illuminate\\Database\\QueryExcepti
This may happen due to any of the following problems:
I also had the same problem. I fixed it, by deleting the database first, then I imported the previous database manually.
And fortunately at that time I still had the previous database backup.
Maybe if you don't have a previous database backup, You can copy all database migrations to a new laravel project, then run 'php artisan migrate' to get the same database as the previous database,
If you encounter with this problem and if it's not caused by migration files then most probably it happens because of 2 possible reasons.
Since ServiceProviders' boot functions and autoloaded custom helper functions are loaded first when laravel is started all the php artisan
commands will generate "Base table or view not found" error.
At this point what you should do is comment out those queries that are querying nonexistent tables and run php artisan serve
then run php artisan migrate
. Then uncomment those lines, save it and everything should work fine.
As @devk suggested it's better to check laravel log files which points exactly to where the problem happens. It led me to find a solution. For this don't forget to Turn on debug mode.
For me, this error was occurring because of a scheduled task in laravel that involved a database lookup. By commenting out that lookup in laravel/app/Console/Kernel.php
from my scheduled task, I was able to migrate my database again.
When you've rolled back these migrations, you've deleted categories
and articles
tables. So just run migrate
command again:
php artisan migrate