title: How to do knex.js migrations?
body: <p>I'm still not sure how to do my migrations with knex. Here is what I have so far. It works on <code>up</code>, but <code>down</code> gives me FK constraint error even though foreign_key_checks = 0.</p>
  
  <pre class="lang-js prettyprint-override"><code>exports.up = function(knex, Promise) {
    return Promise.all([
      knex.raw('SET foreign_key_checks = 0;'),
  
      /* CREATE Member table */
      knex.schema.createTable('Member', function (table) {
        table.bigIncrements('id').primary().unsigned();
        table.string('email',50);
        table.string('password');
  
        /* CREATE FKS */
        table.bigInteger('ReferralId').unsigned().index();
        table.bigInteger('AddressId').unsigned().index().inTable('Address').references('id');
      }),
  
      /* CREATE Address table */
      knex.schema.createTable('Address', function (table) {
        table.bigIncrements('id').primary().unsigned();
        table.index(['city','state','zip']);
  
        table.string('city',50).notNullable();
        table.string('state',2).notNullable();
        table.integer('zip',5).unsigned().notNullable();
      }),
  
      knex.raw('SET foreign_key_checks = 1;')
    ]);
  };
  
  exports.down = function(knex, Promise) {
    return Promise.all([
      knex.raw('SET foreign_key_checks = 0;'),
  
      knex.schema.dropTable('Address'),
  
      knex.schema.dropTable('Member'),
  
      knex.raw('SET foreign_key_checks = 1;')
  
    ]);
  };
  </code></pre>