2022年7月16日星期六

[laravel] unique column migrate

 

建立索引

結構建構器支援多種類型的索引。首先,讓我們看看一個指定欄位的值必須是唯一的例子。要建立索引,我們可以簡單的在欄位定義之後鏈結上 unique 方法:

$table->string('email')->unique();

此外,你可以在定義完欄位之後建立索引。例如:

$table->unique('email');

沒有留言:

發佈留言

[Fixed] some windows chrome, scrolling has glitch position not accurate

   [Fixed] some windows chrome, scrolling has glitch position not accurate Smooth Scrolling Flag 📜 Chrome has an experimental "smooth ...