[英]How to make a no primary key with datatype sting as foreign key in another table
you have to use unique
modifier on your column. 您必须在列上使用
unique
修饰符。
$table->string('doctor_id')->unique();
however, if you set nullable
as the modifier like: 但是,如果将
nullable
设置为修饰符,例如:
$table->string('doctor_id')->unique()->nullable();
it will present another problem when it has multiple records with the same value of null
. 当它有多个具有相同
null
值的记录时,它将提出另一个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.