diff --git a/core/shared/data/migration/001.js b/core/shared/data/migration/001.js index 29dccf23a6..1d295adb16 100644 --- a/core/shared/data/migration/001.js +++ b/core/shared/data/migration/001.js @@ -5,7 +5,7 @@ var when = require('when'), - knex = require('./knex_init'), + knex = require('../../models/knex_init'), fixtures = require('../fixtures/001'), up, down; diff --git a/core/shared/models/dataProvider.bookshelf.js b/core/shared/models/dataProvider.bookshelf.js index d56188262a..53726ab41f 100644 --- a/core/shared/models/dataProvider.bookshelf.js +++ b/core/shared/models/dataProvider.bookshelf.js @@ -6,13 +6,11 @@ (function () { "use strict"; - var knex = require('knex'), + var knex = require('./knex_init'), models = require('./models'), DataProvider, instance; - knex.Initialize(require('../../../config').database[process.env.NODE_ENV || 'development']); - DataProvider = function () { if (!instance) { instance = this; diff --git a/core/shared/models/knex_init.js b/core/shared/models/knex_init.js new file mode 100644 index 0000000000..3d07ba8e07 --- /dev/null +++ b/core/shared/models/knex_init.js @@ -0,0 +1,10 @@ +/*global require, module, process */ +(function () { + "use strict"; + + var knex = require('knex'); + + knex.Initialize(require('../../../config').database[process.env.NODE_ENV || 'development']); + + module.exports = knex; +}()); \ No newline at end of file