我遇到了以下错误:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'street-box.chanels' doesn't exist
所以,经过几个小时试图找到错误,我放弃并做了以下事情:
基本上我有一个新的应用程序。我的目标是逐个迁移每个表以找出问题所在。
我运行第一次迁移(只是用户表和密码)
php artisan migrate
并得到完全相同的错误:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'street-box.chanels' doesn't exist
问题是:
如果我没有迁移并且新数据库有新名称,Laravel会存储有关表的信息吗?
编辑:我的迁移是新鲜的,开箱即用。新数据库具有相同的名称
用户表
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
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 Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
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');
}
}