schema builder laravel migrations unique on two columns

前端 未结 3 1604
离开以前
离开以前 2020-12-23 08:47

How can I set a unique constraints on two columns?

class MyModel extends Migration {
  public function up()
  {
    Schema::create(\'storage_trackers\', fun         


        
3条回答
  •  有刺的猬
    2020-12-23 09:09

    DB::statement("ALTER TABLE `project_majr_actvities`
                   ADD UNIQUE `unique_index`(`activity_sr_no`, `project_id`)");
    

提交回复
热议问题