如何修复运行“php artisan migrate”命令时的“找不到基表或视图:1146”错误?
我正在尝试朗姆酒来生成表迁移,但我收到一个错误:php artisan migrate
[2016-03-08 05:49:01] 当地时间.错误:异常“PDOException”,消息“SQLSTATE[42S02]:未找到基表或视图:1146 表”testing.permissions“在 D:\xampp\htdocs\LMS-testing\vendor\laravel\framework\src\Illuminate\Database\Connection中不存在.php:333
我尝试过未找到基表或视图:1146 Table Laravel 5和做一个Laravel教程,得到“找不到基表或视图:1146表'sdbd_todo.migrations'不存在”,但没有成功。
我也尝试过运行,但得到相同的错误。php artisan list
更新
**RolesPermission migration table**
Schema::create('roles', function(Blueprint $table){
$table->increments('id');
$table->string('name')->unique();
$table->string('label');
$table->string('description')->nullable();
$table->timestamps();
});
Schema::create('permissions', function(Blueprint $table){
$table->increments('id');
$table->string('name')->unique();
$table->string('label');
$table->string('description')->nullable();
$table->timestamps();
});
Schema::create('permission_role', function(Blueprint $table){
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('permission_id')
->references('id')
->on('permissions')
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on('roles')
->onDelete('cascade');
$table->primary(['permission_id', 'role_id']);
});
Schema::create('role_user', function(Blueprint $table){
$table->integer('role_id')->unsigned();
$table->integer('user_id')->unsigned();
$table->foreign('role_id')
->references('id')
->on('roles')
->onDelete('cascade');
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
$table->primary(['role_id', 'user_id']);
});
.env file
APP_ENV=local
APP_DEBUG=true
APP_KEY=W8YWZe3LCngvZzexH3WLWqCDlYRSufuy
DB_HOST=127.0.0.1
DB_DATABASE=testing
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=log
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null