title: Knex.js migrations with unique constraint function
body: <p>I am currently trying to migrate a new table into my database. This table is the users table. Here is the code that I have:</p>
  
  <pre><code>exports.up = function(knex, Promise) {
    return knex.schema.createTableIfNotExists('users', function(table) {
      table.increments('id').primary();
      table.string('first_name').notNullable();
      table.string('last_name').notNullable();
      table.string('email').unique().notNullable();
      table.string('password').notNullable();
      table.timestamps(false, true);
    }).then(() =&gt; {
      console.log('Users Table is Created!');
    })
  };
  
  exports.down = function(knex, Promies) {
    return knex.schema.dropTable('users')
      .then(() =&gt; {
        console.log('Users Table has been Dropped!');
      })
  };
  </code></pre>
  
  <p>This returns the two errors: </p>
  
  <p><code>Knex:warning - migrations failed with error: alter tableusersadd uniqueusers_email_unique(email) - Key column 'email' doesn't exist in table</code></p>
  
  <p><code>Error: Key column 'email' doesn't exist in table</code></p>
  
  <p>It appears that what <code>unique()</code> is trying to do is preform an alter table on a table that I'm trying to create. Thus the error that the email column doesn't exist. Am I doing something wrong here or can you not perform the <code>unique()</code> function on a column when creating a table? I saw examples of using the unique() function in a createTable on the docs. So I'm at a loss as to why this would respond with said error.</p>
  
  <p>My database is getting created and I can see it. It just appears that the <code>unique()</code> constraint doesn't get applied to the email column that does NOT get created either.</p>