From 2e28a1a8c2fda88ebdc2106c1941f8f0230f7b67 Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Sun, 19 May 2013 20:17:21 +0100 Subject: [PATCH] Fixing broken knex_init reference --- core/shared/data/migration/001.js | 2 +- core/shared/models/dataProvider.bookshelf.js | 4 +--- core/shared/models/knex_init.js | 10 ++++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 core/shared/models/knex_init.js 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