我需要使用基于公司ID的序列列创建迁移;
companyID sequence
1 1
1 2
2 1
2 2
有没有一种方法可以使用迁移来创建自动递增的列(序列),该列会根据公司ID递增,而不仅仅是整个列自动递增?
这是我到目前为止所拥有的。
$table->unsignedInteger('companyID');
$table->foreign('companyID')->references('id')->on('company');
$table->increments('sequence');