
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
- 419 page expired error in Laravel
- Laravel upload file with original file name
- How to get route name on visit URL in laravel
- How to remove P tag from CkEditor in Laravel?
- How to display order by null last in laravel
- External link not working in laravel blade
- Laravel file size validation not working
- How to display user profile after login in laravel
- Non-static method App\Http\Helper::myFunction() should not be called statically
- Split an Eloquent Collection by half in Laravel
- The openssl extension is required for SSL/TLS protection but is not available
- Create record with unique slug in laravel
- How to get all route list
- How to get CSRF token in laravel controller
- How to get laravel errors folder in views directory in laravel
- How to validate form input data in laravel
- Get the post details if it has at least one comment in comments table
- How to get query string value in laravel
- Get last record from table in laravel
- How to restore deleted records in laravel
- Class "App\Http\Controllers\Auth\Verified" not found
- How to call model in blade laravel
- Laravel recursive function in controller
- How to get count of all records created at yesterday
- How to get the id of last record from collection object in laravel view