
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel8.projects' doesn't exist
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel8.projects' doesn't exist
In this session, we are going to try to solve the "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel8.projects' doesn't exist" puzzle by using the computer language.
-
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel8.projects' doesn't exist while using migration command
--PATH database\migrations\<yourmigrationfile>.phppublic function up() { //Schema::table('projects', function (Blueprint $table) { Schema::create('projects', function (Blueprint $table) { $table->id(); $table->string('name'); $table->timestamps(); }); }
SQLSTATE[42S02]: Base table or view not found: 1146 Table is the most common error while migrating the table in laravel. Update your migration file instead of
Schema::table('projects', function (Blueprint $table)
useSchema::create('projects', function (Blueprint $table)
in your migration file. There could be any reason for this error but in my case we got the solution usingcreate()
method instead oftable()
method.The table method on the Schema facade may be used to update existing table structure. But create method is used to create the new table structure which is not already exist. The
Schema::table
method is used to modify an existing table, useSchema::create
to create new one.
If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.
Don't forget to share this article! Help us spread the word by clicking the share button below.
We appreciate your support and are committed to providing you valuable and informative content.
We are thankful for your never ending support.
Random Code Snippet Queries: Laravel
- How to call controller function from view in Laravel
- Non-static method App\Http\Helper::myFunction() should not be called statically
- The openssl extension is required for SSL/TLS protection but is not available
- Pass variable from blade to controller Laravel
- Laravel insert query not working
- Call to undefined function Illuminate\Encryption\openssl_cipher_iv_length()
- Method Illuminate\Events\Dispatcher::fire does not exist
- Laravel recursive function in controller
- Class App\Http\Controllers\Admin\UserController Does Not Exist
- Conditional where clause in Laravel
- How to insert dynamic value to additional column in pivot table in laravel
- Class "App\Http\Controllers\Auth\Verified" not found
- Create records using relationship in laravel
- Remove public from url in laravel project
- How to get images from AWS s3 and display in Laravel blade
- Laravel upload file with original file name
- Laravel get count with where condition
- Seed database using SQL file in Laravel
- Call to undefined relationship [user] on model [App\Models\Post]
- How to get the id of last record from collection object in laravel view
- How to get session in blade Laravel ?
- How to make Copy or Duplicate table row in laravel
- The Pusher library requires the PHP cURL module. Please ensure it is installed
- The POST method is not supported for this route. Supported methods: PUT.
- How to run a specific seeder class in laravel