Closed pvsaintpe closed 5 years ago
Extending creating unique indexes with conditions on where, example:
where
Schema::create('cities', static function (Blueprint $table) { ... $table->uniquePartial(['name', 'author_id']) ->where('editor_id', 1) ->whereRaw('field1 = ? and field2 <= ?', ['field1', 'field2']) ->whereNotNull('deleted_at') ->whereBetween('author_id', [1, 2, 3]); ...
PS. If you will use $table->uniquePartial() without extend methods after call uniquePartial(), it works as $table->unique().
$table->uniquePartial()
uniquePartial()
$table->unique()
3
Extending creating unique indexes with conditions on
where
, example:PS. If you will use
$table->uniquePartial()
without extend methods after calluniquePartial()
, it works as$table->unique()
.