Laravel迁移遇到问题

时间:2020-06-18 00:42:42

标签: laravel migration

我已添加所有约束2020_06_17_221942_create_constraints_table 但它不起作用 成功完成所有迁移,但没有任何表约束,2020_06_17_221942_create_constraints_table为:

from multiprocessing import Pool
from iteltools import repeat
p = multiprocessing.Pool(processes=3)
for conf in confs:
  p.starmap( some_func, zip(event_list, repeat(conf), repeat(overwrite))

2 个答案:

答案 0 :(得分:0)

尝试在迁移功能中添加“蓝图”类型提示。它应该可以工作

例如:

Schema::table('seasons', function (Blueprint $table) {
        $table->unsignedBigInteger('best_project_id');
        $table->unsignedBigInteger('manager_id');
        $table->foreign('best_project_id')->references('id')->on('projects');
        $table->foreign('manager_id')->references('id')->on('users');
});

答案 1 :(得分:0)

以此替换您的上一个查询

Schema::table('projects', function (Blueprint $table) {
$table->unsignedBigInteger('study_major_id');
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('season_id');
    $table->foreign('study_major_id')->references('id')->on('study_majors');
    $table->foreign('user_id')->references('id')->on('Users');
    $table->foreign('season_id')->references('id')->on('Seasons');
});