title: NodeJS and Knex - tables are not created automatically
body: <p>I have NodeJS application base on SQLite. My problem is that DB is not being initialized on startup. No tables are created but my queries run fine (with no such table error).
  Here is my config.js contents. This file is called whenever database is neeeded.</p>
  
  <pre><code>var knex = require('knex')({
      client: 'sqlite3',
      connection: {
          filename: "db.sqlite"
      },
      useNullAsDefault: true
  });
  
  //var bookshelf = require('bookshelf')(knex);
  //bookshelf.plugin('registry');
  
  module.exports = {
      "port": process.env.PORT || 3000,
      "secretKey": "MyOwnSecretKey",
      "knex": knex
      //"bookshelf": bookshelf
  };
  </code></pre>
  
  <p>Now in my user.js file I am calling this with the following:</p>
  
  <pre><code>var config = require('../../config');
  var bcrypt = require('bcrypt-nodejs');
  
  var knex = config.knex;
  knex.schema.createTableIfNotExists('users', function(table) {
      table.increments();
      table.string('name', 128);
      table.string('username', 128);
      table.string('password');
      //table.string('email', 128);
      //table.string('role').defaultTo('admin');    
      table.timestamps();
  });
  
  //var bookshelf = config.bookshelf;
  var bookshelf = require('bookshelf')(knex);
  bookshelf.plugin('registry');
  
  var User = bookshelf.Model.extend({
      tableName: 'users',
      ...
  </code></pre>
  
  <p>when I try to call any method getting or creating data I have error that the table does not exist. I have moved table creation part to my server.js file too but it also didn't create the table (although debugging show that it should).
  What is the catch here? Or perhaps there is a better way to create tables that this?</p>