Laravel 找不到基表或视图:1146表';db.ken#u权限';不';不存在
有时,当我打字时:Laravel 找不到基表或视图:1146表';db.ken#u权限';不';不存在,laravel,Laravel,有时,当我打字时: php artisan php artisan migrate etc 我得到的信息是: [Illuminate\Database\QueryException] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.ken_permissions' doesn't exist (SQL: select * fro
php artisan
php artisan migrate
etc
我得到的信息是:
[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.ken_permissions' doesn't exist (SQL: select * from `ken_permissions`)
在调试过程中,我可以在artisan文件中发现问题:
$status = $kernel->handle(
$input = new Symfony\Component\Console\Input\ArgvInput,
new Symfony\Component\Console\Output\ConsoleOutput
);
我已经检查了这个答案,但没有成功:
bootstrap/app.php是干净的
我没有应用程序/启动文件夹(L5.1)
php是干净的
php artisan-v或php artisan——假装不起作用,因为artisan在运行之前失败了
我唯一拥有的就是应用程序/提供商
public function boot(GateContract $gate)
{
parent::registerPolicies($gate);
// Dynamically register permissions with Laravel's Gate.
foreach ($this->getPermissions() as $permission) {
$gate->define($permission->name, function ($user) use ($permission) {
return $user->hasPermission($permission);
});
}
}
一种解决方案是删除我的所有表,然后composer转储自动加载,然后它再次工作,但它会不断返回
这是跟踪迁移失败的一种方法吗?
知道为什么会这样吗
德克萨斯州 加入观察者的答案 您可以将迁移移动到
数据库/temp文件夹
,然后逐个运行迁移
php artisan迁移--path=database/temp
您将知道是哪个迁移导致了问题。
注意
你也可以使用
php artisan migrate——假装
获取您试图执行的查询。添加到观察者的答案中
您可以将迁移移动到数据库/temp文件夹
,然后逐个运行迁移
php artisan迁移--path=database/temp
您将知道是哪个迁移导致了问题。
注意
你也可以使用
php artisan migrate——假装
获取您试图执行的查询。转到App\Provider\AuthServiceProvider
如果您使用启动方法GateContract($this->getPermission()等),请在
parent::registerPolicies($gate)之后删除或添加所有注释代码>并完成运行php artisan migrate
转到App\Provider\AuthServiceProvider
如果您使用启动方法GateContract($this->getPermission()等),请在parent::registerPolicies($gate)之后删除或添加所有注释代码>并完成运行php artisan migrate
请参考观察者的答案请参考观察者的答案您是否尝试将迁移移动到临时文件夹?是否尝试将迁移移动到临时文件夹?
Remove any lines requesting data from your model from these files to be sure artisan is not trying to load data from your non-existent table:
bootstrap/start.php
app/start/global.php
app/start/local.php
app/routes.php
Also be sure to un-register any service providers that utilize data from that table in their register or boot methods inside of app/config/app.php.