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