title: Knex.js - How to create unique index with 'where' clause?
body: <p>I'm using Knex.js. I'd like to create a unique index for my table with WHERE clause:</p>
  
  <pre><code>db.schema.createTable('newTable', function(t) {
    t.increments()
    t.string('col1').defaultTo(null)
    t.string('col2').notNullable()
    t.integer('col3').notNullable()
    t.unique(['col1', 'col2', 'col3']).whereNotNull('col1')
    t.unique(['col2', 'col3']).whereNull('col1')
  })
  </code></pre>
  
  <p>I try to create two partial indexes for the table. However, <code>whereNotNull</code> is not chainable with <code>unique</code> function. How to create a unique index with 'where' clause?</p>