Laravel 4: making a combination of values/columns unique

后端 未结 5 1980
灰色年华
灰色年华 2020-12-14 01:07

I\'m importing a bunch of csv entries in my database with Laravel 4.

I can\'t really point at one column that has to be unique, it\'s a combination of 5 columns that

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-14 01:35

    You can also do this;

    $table->unique(["column1", "column2"], 'uq_columns');

    Which means that you will have a unique column combination of all the columns i.e. column1 and column2

提交回复
热议问题