mirror of
https://github.com/strapi/strapi.git
synced 2025-11-16 01:57:56 +00:00
Waiting knex fired event before load bookshelf
This commit is contained in:
parent
3734bb2f59
commit
1b7e1b9e6a
@ -37,16 +37,16 @@ module.exports = function (strapi) {
|
|||||||
initialize: function (cb) {
|
initialize: function (cb) {
|
||||||
let globalName;
|
let globalName;
|
||||||
|
|
||||||
|
// Only run this logic after the Knex has finished to load.
|
||||||
|
strapi.after('hook:knex:loaded', function () {
|
||||||
|
|
||||||
// Make sure the Knex hook is present since Knex needs it.
|
// Make sure the Knex hook is present since Knex needs it.
|
||||||
if (!strapi.hooks.knex) {
|
if (!strapi.hooks.external.knex) {
|
||||||
strapi.log.error('Impossible to load the ORM without the query builder!');
|
strapi.log.error('Impossible to load the ORM without the query builder!');
|
||||||
strapi.log.error('You need to install the Strapi query builder with `$ npm install strapi-knex --save`.');
|
strapi.log.error('You need to install the Strapi query builder with `$ npm install strapi-knex --save`.');
|
||||||
strapi.stop(1);
|
strapi.stop(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only run this logic after the Knex has finished to load.
|
|
||||||
strapi.after('hook:knex:loaded', function () {
|
|
||||||
|
|
||||||
// Initialize collections
|
// Initialize collections
|
||||||
_.set(strapi, 'bookshelf.collections', {});
|
_.set(strapi, 'bookshelf.collections', {});
|
||||||
|
|
||||||
|
|||||||
@ -63,6 +63,7 @@ module.exports = function (strapi) {
|
|||||||
cb(err);
|
cb(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return memo;
|
return memo;
|
||||||
}, {}));
|
}, {}));
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user