Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-21T14:03:29.540Z
Answers.LastActivityDate: 2018-06-21T14:03:29.540Z
Answers.UserDisplayName: Luke Pearce
Body: <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>
  
Tags: <records>
Title: What do multiple columns of a record being set to unique mean?
ThreadText: # 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.
  
  
  ---
  
  