1

I have to code some feature on a an existing laravel project. I added docker for local development.

I got some errors that I fixed but I can't fix this one. When I load the page I have this error:

Base table or view not found: 1146 Table 'laraveldb.static_pages' doesn't exist (SQL: select * from `static_pages`)

Very easy to fix, I thought, I just have to run the migration with artisan:

docker-compose exec app php artisan migrate

It gives me the same error.

Every artisan commands seem to throw this error. (serve, cache:clear, optimize, even -v)

I understand that the error is probably in the loading of artisan or something like that, but I search on the web for similar errors with every keyword I could think of, I found only one person with the same problem, and no answers.

I already reinstalled vendors, etc. it did not work.

Maybe it's linked to docker, maybe to the Laravel configs, maybe to my system?

I don't often post here, but I don't know where to look to continue to debug my issue.

Have you ever seen something similar?

Php version: 7.4-fpm Cache: file Laravel version: 9.4.1

Here the callstack:

[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laraveldb.static_pages' doesn't exist at /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:82)
[stacktrace]
#0 /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(82): PDO->prepare('select * from `...', Array)
#1 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(368): Doctrine\\DBAL\\Driver\\PDOConnection->prepare('select * from `...')
#2 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(705): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}('select * from `...', Array)
#3 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#4 /var/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\\Database\\Connection->run('select * from `...', Array, Object(Closure))
#5 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\\Database\\Connection->select('select * from `...', Array, true)
#6 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\\Database\\Query\\Builder->runSelect()
#7 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\\Database\\Query\\Builder->Illuminate\\Database\\Query\\{closure}()
#8 /var/www/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\\Database\\Query\\Builder->onceWithColumns(Array, Object(Closure))
#9 /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(625): Illuminate\\Database\\Query\\Builder->get(Array)
#10 /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(609): Illuminate\\Database\\Eloquent\\Builder->getModels(Array)
#11 /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(568): Illuminate\\Database\\Eloquent\\Builder->get(Array)
#12 /var/www/app/Providers/AppServiceProvider.php(30): Illuminate\\Database\\Eloquent\\Model::all()
#13 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Providers\\AppServiceProvider->boot()
#14 /var/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#15 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#16 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#17 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#18 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(924): Illuminate\\Container\\Container->call(Array)
#19 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(905): Illuminate\\Foundation\\Application->bootProvider(Object(App\\Providers\\AppServiceProvider))
#20 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}(Object(App\\Providers\\AppServiceProvider), 32)
#21 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(906): array_walk(Array, Object(Closure))
#22 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#23 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#24 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#25 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#26 /var/www/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
rm4
  • 711
  • 4
  • 15
  • "It gives me the same error." - that error being "Base table or view not found: 1146 Table 'laraveldb.static_pages' doesn't exist (SQL: select * from `static_pages`)"? Or is the error you get when you try to run the command different? – James Mar 09 '22 at 01:27
  • @James it is the exact same error. With a red header and some details under. – rm4 Mar 09 '22 at 01:36
  • Indeed, it is a duplicate. One of the unaccepted answer even fixed my problem. Do you think it's better to add the answer that fixed my issue as a response to this thread and mark it as the correct answer, or it's better to delete it to avoid duplication? – rm4 Mar 09 '22 at 01:41
  • I've voted to close this question as a duplicate. But you're welcome to add your own answer or delete the question - whatever you feel is reasonable. – James Mar 09 '22 at 02:28

0 Answers0