[英]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.