微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Laravel 8

如何解决Laravel 8

我有一个使用 Laravel Passport oauth_clients 的表,主键类型为 UUID。要求是创建一个具有名为 client_id 的外键列的新表,该列引用 oauth_clients 表的主键,但出现以下错误

外键约束格式不正确

代码

$table->foreignUuid('oauth_client_id')->nullable()->constrained()
    ->onDelete('CASCADE')
    ->onUpdate('CASCADE');

迁移/架构

$this->schema->create('oauth_clients',function (Blueprint $table) {
    $table->uuid('id');
    $table->unsignedBigInteger('user_id')->nullable()->index();
    $table->string('name');
    $table->string('website_color',50)->nullable();
    $table->string('website_logo',255)->nullable();
    $table->string('secret',100)->nullable();
    $table->string('provider')->nullable();
    $table->text('redirect');
    $table->boolean('personal_access_client');
    $table->boolean('password_client');
});

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。