Laravel Base table or view not found in a new fresh database
I came across the following error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'street-box.chanels' doesn't exist
So, after hours trying to find the erroor I gave up and did the following:
- I made a backup of everything.
- I “GIT” and created a new branch.
- I deleted the database and created a new one fresh with a new name.
- I declare the new database in the .ENV file
- I deleted all migrations and let just the passwords and user migrations unchanged (fresh).
- I deleted the log file and emptied the storageframeworkviews directory
- I restarted the server.
Basically I have a new app. My goal ist migrate one by one each table to figure out where the problem is.
I run the first migration (just user table and passwords)
php artisan migrate
and get the exact same error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'street-box.chanels' doesn't exist
The question is:
Where Laravel store the information about tables if I have not migrations and a fresh database with a new name?
EDIT: My migrations are fresh, out of the box. The new database has the same name
Usertable
<?php
use IlluminateSupportFacadesSchema;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateDatabaseMigrationsMigration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('slug')->unique();
$table->string('email')->unique();
$table->string('password');
$table->integer('role_id')->index()->default(3);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
Passwort
<?php
use IlluminateSupportFacadesSchema;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateDatabaseMigrationsMigration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-base-table-or-view-not-found-in-a-new-fresh-database/
via Lzo Media
No comments:
Post a Comment