title: QueryException : SQLSTATE[42S02] Base table or view not found
body: <p>So I have an error while try to run laravel from my github repo. It says SQLSTATE[42502], I try to solve by looking the same topic, but still, comeback stuck.</p>
  <p><strong>The chronological order is simple like this</strong></p>
  <ol>
  <li>I pull a repository from github</li>
  <li>I run composer update and all package in vendors folder started to install one by one</li>
  <li>Until it try to generate best auto-load and the error appears</li>
  </ol>
  <p>BTW I only have the database migration file and not the .SQL one.</p>
  <p>So if anyone of you could help, I really appreciate it. Thanks</p>
  <pre><code>Illuminate\Database\QueryException  : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.product_requests' doesn't exist (SQL: select count(*) as aggregate from `product_requests` where `read_at` is null)
  
    at C:\xampp\htdocs\ayoreview-master\vendor\laravel\framework\src\Illuminate\Database\Connection.php:669
      665|         // If an exception occurs when attempting to run a query, we'll format the error
      666|         // message to include the bindings with SQL, which will make this exception a
      667|         // lot more helpful to the developer instead of just the database's errors.
      668|         catch (Exception $e) {
    &gt; 669|             throw new QueryException(
      670|                 $query, $this-&gt;prepareBindings($bindings), $e
      671|             );
      672|         }
      673|
  
    Exception trace:
  
    1   Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(App\Providers\AppServiceProvider))
        [internal]:0
  
    2   Doctrine\DBAL\Driver\PDOException::(&quot;SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.product_requests' doesn't exist&quot;)
        C:\xampp\htdocs\ayoreview-master\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:66
  </code></pre>
  <p>My related migration file for <strong>product_requests</strong></p>
  <pre><code>&lt;?php
  
  use Illuminate\Database\Migrations\Migration;
  use Illuminate\Database\Schema\Blueprint;
  use Illuminate\Support\Facades\Schema;
  
  class CreateProductRequestsTable extends Migration
  {
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::create('product_requests', function (Blueprint $table) {
              $table-&gt;bigIncrements('id');
              $table-&gt;string('name');
              $table-&gt;text('specification');
              $table-&gt;bigInteger('price');
              $table-&gt;string('link');
              $table-&gt;string('featured_image');
              $table-&gt;unsignedBigInteger('user_id');
              $table-&gt;unsignedBigInteger('category_id')-&gt;nullable();
              $table-&gt;unsignedBigInteger('brand_id')-&gt;nullable();
              $table-&gt;text('description')-&gt;nullable();
              $table-&gt;dateTime('read_at')-&gt;nullable();
              $table-&gt;dateTime('exported_at')-&gt;nullable();
              $table-&gt;timestamps();
          });
      }
  
      /**
       * Reverse the migrations.
       *
       * @return void
       */
      public function down()
      {
          Schema::dropIfExists('product_requests');
      }
  }
  </code></pre>
  <p><strong>More Detail</strong></p>
  <p>AppServiceProvider</p>
  <pre><code>&lt;?php
  
  namespace App\Providers;
  
  use App\ProductRequest;
  use Illuminate\Pagination\Paginator;
  use Illuminate\Support\Facades\Config;
  use Illuminate\Support\Facades\URL;
  use Illuminate\Support\ServiceProvider;
  
  class AppServiceProvider extends ServiceProvider
  {
      /**
       * Register any application services.
       *
       * @return void
       */
      public function register()
      {
          if(Config::get('app.redirect_https')) {
              URL::forceScheme('https');
          }
      }
  
      /**
       * Bootstrap any application services.
       *
       * @return void
       */
      public function boot()
      {
          if(Config::get('app.redirect_https')) {
              $this-&gt;app['request']-&gt;server-&gt;set('HTTPS', true);
          }
  
          Paginator::defaultView('custom.pagination');
  
          $unreadRequestedProduct = ProductRequest::whereNull('read_at')-&gt;count();
          session()-&gt;flash('product_request', $unreadRequestedProduct);
      }
  }
  </code></pre>
  <p>Full trace when doing composer update</p>
  <pre><code>C:\xampp\htdocs\ayoreview-master&gt;composer update
  Loading composer repositories with package information
  Updating dependencies (including require-dev)
  Package operations: 0 installs, 1 update, 0 removals
    - Updating laravel/framework (v6.18.31 =&gt; v6.18.32): Downloading (100%)
  Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
  Package jakub-onderka/php-console-color is abandoned, you should avoid using it. Use php-parallel-lint/php-console-color instead.
  Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead.
  Writing lock file
  Generating optimized autoload files
  Deprecation Notice: Class Guzzle\Tests\Common\Cache\NullCacheAdapterTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Cache\NullCacheAdapterTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Common\AbstractHasAdapterTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Common\AbstractHasDispatcherTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Message\HeaderComparisonTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Http\Message\HeaderComparisonTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Http\Message\HttpRequestFactoryTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Http\Message\RequestFactoryTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Message\ResponseTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Http\Message\ResponseTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Http\CommaAggregatorTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Http\QueryAggregator\CommaAggregatorTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Http\DuplicateAggregatorTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Http\QueryAggregator\DuplicateAggregatorTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Http\PhpAggregatorTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Http\QueryAggregator\PhpAggregatorTest.php
  does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Plugin\Redirect\RedirectPluginTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Http\RedirectPluginTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Plugin\Redirect\StaticClientTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Http\StaticClientTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Parsers\UriTemplate\AbstractUriTemplateTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Parser\UriTemplate\AbstractUriTemplateTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Parsers\UriTemplate\PeclUriTemplateTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Parser\UriTemplate\PeclUriTemplateTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Parsers\UriTemplate\UriTemplateTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Parser\UriTemplate\UriTemplateTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Service\ServiceBuilderTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Service\Builder\ServiceBuilderTest.php
  does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Service\Command\AliasFactoryTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Service\Command\Factory\AliasFactoryTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Service\Command\CompositeFactoryTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Service\Command\Factory\CompositeFactoryTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Service\Command\ConcreteClassFactoryTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Service\Command\Factory\ConcreteClassFactoryTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Service\Command\MapFactoryTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Service\Command\Factory\MapFactoryTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Service\Command\ServiceDescriptionFactoryTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Service\Command\Factory\ServiceDescriptionFactoryTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  Deprecation Notice: Class Guzzle\Tests\Service\Command\VisitorFlyweightTest located in C:/xampp/htdocs/ayoreview-master/vendor/guzzle/guzzle/tests\Guzzle\Tests\Service\Command\LocationVisitor\VisitorFlyweightTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:201
  &gt; Illuminate\Foundation\ComposerScripts::postAutoloadDump
  &gt; @php artisan package:discover --ansi
  
     Illuminate\Database\QueryException  : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.product_requests' doesn't exist (SQL: select count(*) as aggregate from `product_requests` where `read_at` is null)
  
    at C:\xampp\htdocs\ayoreview-master\vendor\laravel\framework\src\Illuminate\Database\Connection.php:669
      665|         // If an exception occurs when attempting to run a query, we'll format the error
      666|         // message to include the bindings with SQL, which will make this exception a
      667|         // lot more helpful to the developer instead of just the database's errors.
      668|         catch (Exception $e) {
    &gt; 669|             throw new QueryException(
      670|                 $query, $this-&gt;prepareBindings($bindings), $e
      671|             );
      672|         }
      673|
  
    Exception trace:
  
    1   Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(App\Providers\AppServiceProvider))
        [internal]:0
  
    2   Doctrine\DBAL\Driver\PDOException::(&quot;SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.product_requests' doesn't exist&quot;)
        C:\xampp\htdocs\ayoreview-master\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:66
  
    Please use the argument -v to see more details.
  Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
  </code></pre>
  <p>Composer.json</p>
  <pre><code>{
      &quot;name&quot;: &quot;laravel/laravel&quot;,
      &quot;type&quot;: &quot;project&quot;,
      &quot;description&quot;: &quot;The Laravel Framework.&quot;,
      &quot;keywords&quot;: [
          &quot;framework&quot;,
          &quot;laravel&quot;
      ],
      &quot;license&quot;: &quot;MIT&quot;,
      &quot;require&quot;: {
          &quot;php&quot;: &quot;^7.2&quot;,
          &quot;ext-gd&quot;: &quot;*&quot;,
          &quot;ext-imagick&quot;: &quot;*&quot;,
          &quot;doctrine/dbal&quot;: &quot;^2.10&quot;,
          &quot;fideloper/proxy&quot;: &quot;^4.0&quot;,
          &quot;fruitcake/laravel-cors&quot;: &quot;^2.0&quot;,
          &quot;guzzlehttp/guzzle&quot;: &quot;^7.0&quot;,
          &quot;intervention/image&quot;: &quot;^2.5&quot;,
          &quot;laravel/framework&quot;: &quot;^6.2&quot;,
          &quot;laravel/sanctum&quot;: &quot;^2.3&quot;,
          &quot;laravel/socialite&quot;: &quot;^4.4&quot;,
          &quot;laravel/tinker&quot;: &quot;^2.0&quot;,
          &quot;league/flysystem-aws-s3-v3&quot;: &quot;~1.0&quot;,
          &quot;santigarcor/laratrust&quot;: &quot;^6.0&quot;,
          &quot;yajra/laravel-datatables-oracle&quot;: &quot;~9.0&quot;
      },
      &quot;require-dev&quot;: {
          &quot;barryvdh/laravel-debugbar&quot;: &quot;^3.3&quot;,
          &quot;barryvdh/laravel-ide-helper&quot;: &quot;^2.7&quot;,
          &quot;facade/ignition&quot;: &quot;^1.4&quot;,
          &quot;fzaninotto/faker&quot;: &quot;^1.9.1&quot;,
          &quot;laravel/ui&quot;: &quot;^1.0&quot;,
          &quot;mockery/mockery&quot;: &quot;^1.0&quot;,
          &quot;nunomaduro/collision&quot;: &quot;^3.0&quot;,
          &quot;phpunit/phpunit&quot;: &quot;^8.0&quot;,
          &quot;spatie/laravel-web-tinker&quot;: &quot;^1.7&quot;
      },
      &quot;config&quot;: {
          &quot;optimize-autoloader&quot;: true,
          &quot;preferred-install&quot;: &quot;dist&quot;,
          &quot;sort-packages&quot;: true
      },
      &quot;extra&quot;: {
          &quot;laravel&quot;: {
              &quot;dont-discover&quot;: []
          }
      },
      &quot;autoload&quot;: {
          &quot;psr-4&quot;: {
              &quot;App\\&quot;: &quot;app/&quot;
          },
          &quot;files&quot;: [
              &quot;app/Helpers/helper.php&quot;
          ],
          &quot;classmap&quot;: [
              &quot;database/seeds&quot;,
              &quot;database/factories&quot;
          ]
      },
      &quot;autoload-dev&quot;: {
          &quot;psr-4&quot;: {
              &quot;Tests\\&quot;: &quot;tests/&quot;
          }
      },
      &quot;minimum-stability&quot;: &quot;dev&quot;,
      &quot;prefer-stable&quot;: true,
      &quot;scripts&quot;: {
          &quot;post-autoload-dump&quot;: [
              &quot;Illuminate\\Foundation\\ComposerScripts::postAutoloadDump&quot;,
              &quot;@php artisan package:discover --ansi&quot;
          ],
          &quot;post-root-package-install&quot;: [
              &quot;@php -r \&quot;file_exists('.env') || copy('.env.example', '.env');\&quot;&quot;
          ],
          &quot;post-create-project-cmd&quot;: [
              &quot;@php artisan key:generate --ansi&quot;
          ],
          &quot;post-update-cmd&quot;: [
              &quot;Illuminate\\Foundation\\ComposerScripts::postUpdate&quot;,
              &quot;@php artisan ide-helper:generate&quot;
          ]
      }
  }
  </code></pre>