是的,可以不使用Laravel Passport的默认迁移。以下是一个简单的解决方法:
php artisan make:migration create_oauth_clients_table --create=oauth_clients
这将在database/migrations
目录中创建一个新的迁移文件。
up
方法中:use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateOauthClientsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth_clients', function (Blueprint $table) {
$table->increments('id');
$table->string('name', 255)->nullable();
$table->string('secret', 100)->nullable();
$table->text('redirect')->nullable();
$table->tinyInteger('personal_access_client')->default(0);
$table->tinyInteger('password_client')->default(0);
$table->tinyInteger('revoked')->default(0);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('oauth_clients');
}
}
此迁移文件将创建一个名为oauth_clients
的数据表,该表包含与Laravel Passport默认迁移中的相同字段。
php artisan migrate
这将运行新创建的迁移文件,并创建oauth_clients
表。
现在,您已经成功创建了与Laravel Passport默认迁移中相同的oauth_clients
表,而不使用Passport的默认迁移。