Connection.php第651行中的Laravel QueryException:SQLSTATE[42S02]:未找到基表或视图
我是拉雷维尔的新手,有个错误。 当我尝试检查我的页面时,出现以下错误:Connection.php第651行中的Laravel QueryException:SQLSTATE[42S02]:未找到基表或视图,php,mysql,laravel,laravel-5,Php,Mysql,Laravel,Laravel 5,我是拉雷维尔的新手,有个错误。 当我尝试检查我的页面时,出现以下错误: QueryException在Connection.php第651行: SQLSTATE[42S02]:未找到基表或视图:1146表“scotchbox.likes”不存在(SQL:选择“users”。*,“users”。“name”,“projects”。“title”来自“user\u id”=“users”上的“likes”内部联接“users”。“id”来自“project\u id”=“projects”。“id”
QueryException在Connection.php第651行:
SQLSTATE[42S02]:未找到基表或视图:1146表“scotchbox.likes”不存在(SQL:选择“users”。*,“users”。“name”,“projects”。“title”来自“user\u id”=“users”上的“likes”内部联接“users”。“id”来自“project\u id”=“projects”。“id”)
这是我的迁移:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLikesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('likes', function(Blueprint $table){
$table->increments('id');
$table->integer('project_id');
$table->integer('user_id');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('likes');
}
}
php artisan migrate
我已经回滚了迁移,刷新了迁移,。。。但这没用
有人能帮我吗?运行迁移:
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLikesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('likes', function(Blueprint $table){
$table->increments('id');
$table->integer('project_id');
$table->integer('user_id');
$table->softDeletes();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('likes');
}
}
php artisan migrate
您应该在控制台中运行迁移。它在数据库中创建
likes
表
php artisan migrate
如果您想了解有关迁移的信息:请尝试以下操作:
创建具有特定表名的模型,在文本编辑器中打开模型添加以下行:
protected $table = 'tablename';
看起来是这样的:
class Gallery extends Model
{
protected $table = 'tablename';
}
已经做过几次了。我的迁移是最新的(控制台显示:无需迁移),请在phpmyadmin中检查您的数据库。真的创建了这个表吗?如果没有,请从迁移表中删除“likes”行,然后重新运行php artisan migrate。。。这就是问题所在,我已经做过几次了。我的迁移是最新的(控制台显示:无需迁移)