Laravel 5.8错误SQLSTATE [HY000]:常规错误:1005 uuid

问题描述 投票:0回答:1

我正在使用Laravel 5.8和软件包"goldspecdigital/laravel-eloquent-uuid",因为我需要使用UUID4,这是我的迁移文件:

 public function up()
    {
        Schema::create('images', function (Blueprint $table) {
            $table->bigIncrements('id');
            // $table->timestamps();
            $table->string('path');
            $table->uuid('visit_id');
            $table->foreign('visit_id')->references('id')->on('visits');

        });
    }

我收到以下错误:

SQLSTATE [HY000]:常规错误:1005无法创建表doctors _pharmacyimages(错误号:150“外键约束格式不正确”)(SQL:更改表images 添加约束images_visit_id_foreign外部键(visit_id)引用visitsid))

我该如何解决?

laravel-5 eloquent laravel-5.8
1个回答
0
投票

如下更新schemavisitsimages。然后运行php artisan migrate cmd。

© www.soinside.com 2019 - 2024. All rights reserved.