<p>It means that no combination of those two columns can be the same in the table stated in the <code>getTableName()</code> of your record.</p>

CC BY-SA 4.0
2018-06-21T14:03:29.540Z
2018-06-21T14:03:29.540Z
Luke Pearce
<p>Does the following mean that <em>both</em> columns or the <em>combination</em> of columns needs to be unique?</p>

<pre><code>public function defineIndexes()
{
    return [
        ['columns' =&gt; ['productId', 'productTypeId'], 'unique' =&gt; true],
    ];
}
</code></pre>

<records>
What do multiple columns of a record being set to unique mean?
# What do multiple columns of a record being set to unique mean?

(Asked by: username_0 on 2018-06-21)

Does the following mean that both columns or the combination of columns needs to be unique?
public function defineIndexes()
{
    return [
        ['columns' => ['productId', 'productTypeId'], 'unique' => true],
    ];
}

**Tags:** records


---

## 1 answers

### Answer by username_0 on 2018-06-21. Score: 3 | Accepted answer

It means that no combination of those two columns can be the same in the table stated in the `getTableName()` of your record.


---

