laravel9 migrations问题,解决问题送腾讯视频VIP一个月

99次阅读

共计 282 个字符,预计需要花费 1 分钟才能阅读完成。

2022_08_05_010456_create_posts_table.php

  1. Schema::create(‘posts’, function (Blueprint $table) {
  2.         $table->foreignId(‘category_id’);
  3.         $table->foreign(‘category_id’)->references(‘id’)->on(‘users’);
  4. });

复制代码

table 只有改成 users 可以迁移成功,其他任何 table 都失败,比如:categories

网友回复:

注册 你的 users 是在 posts 之前就 migration 了吗

正文完
 0