Php SQLSTATE[42S22]:未找到列:1054未知列';供应商';在';字段列表';(SQL:插入到“oauth_客户机”中`
我使用的是Laravel版本8,我正在尝试运行Php SQLSTATE[42S22]:未找到列:1054未知列';供应商';在';字段列表';(SQL:插入到“oauth_客户机”中`,php,mysql,laravel,Php,Mysql,Laravel,我使用的是Laravel版本8,我正在尝试运行php artisan迁移:刷新--seed和php artisan passport:install 迁移和种子设定成功运行,但php artisan passport:install失败 SQLSTATE[42S22]:未找到列:“字段列表”中的1054未知列“提供程序”(SQL:insert intooauth\u clients(user\u id,name,secret,提供者,重定向,个人访问客户端,密码客户端,撤销,更新,创建)值(?,
php artisan迁移:刷新--seed和php artisan passport:install
迁移和种子设定成功运行,但php artisan passport:install
失败
SQLSTATE[42S22]:未找到列:“字段列表”中的1054未知列“提供程序”(SQL:insert intooauth\u clients
(user\u id
,name
,secret
,提供者
,重定向
,个人访问客户端
,密码客户端
,撤销
,更新
,创建
)值(?,Laravel个人访问客户端,Wa44O2Z3IA23st3wbgQHvDkapJlS75ZXO7MZ4A4Q?,http://localhost2021-02-1115:09:292021-02-1115:09:29)
基本上,在尝试插入令牌时,找不到列提供程序
,在检查我的oauth_clients_表迁移文件时,可以看到列提供程序
实际上丢失了
public function up()
{
Schema::create('oauth_clients',函数(Blueprint$表){
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->nullable()->index();
$table->string('name');
$table->string('secret',100)->nullable();
$table->text('redirect');
$table->boolean('personal_access_client');
$table->boolean('password_client');
$table->boolean('reversed');
$table->timestamps();
});
}
我似乎找不到有关该专栏的信息,我的问题是,由于该迁移是自动生成的,在我升级应用程序之前,该专栏的结构是什么
编辑1
我在下面试过,但失败了
$table->string('provider');
SQLSTATE[23000]:完整性约束冲突:1048列“提供程序”不能为空(SQL:insert intooauth\u客户端
(user\u id
,name
,secret
,提供者
,重定向
,个人访问客户端
,密码客户端
,撤销
,更新
,创建
)值(?,Laravel个人访问客户端,Giz5BQGQTBBVCUIUPO3BHMZHLK0YLIQ22LVJWGG?,http://localhost2021-02-1115:33:282021-02-1115:33:28)
所以我补充说
$table->string('provider')->nullable('web');
上述方法有效,但现在我的问题是
oauth\u clients
表中的provider
列的用途是什么在Upgrade.md文件中,它提到: 从8.x升级到9.0 支持多个卫士 公共关系: Passport现在支持多个guard用户提供程序。因为 如果要进行此更改,必须在
oauth\u客户端中添加provider
列
数据库表:
Schema::table('oauth_clients', function (Blueprint $table) {
$table->string('provider')->after('secret')->nullable();
});
如果您以前没有发布Passport迁移,您可以
应手动将提供程序
列添加到数据库中
因此,我刚刚添加了以下迁移:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddProviderColumnToOauthClientsTable extends Migration
{
public function up()
{
Schema::table('oauth_clients', function (Blueprint $table) {
$table->string('provider')->after('secret')->nullable();
});
}
public function down()
{
Schema::table('oauth_clients', function (Blueprint $table) {
$table->dropColumn('provider');
});
}
}
您是否升级了laravel框架或passport?请检查ThreadThank@porloscerosψ该链接非常有用