mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +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) {
|
||||
let globalName;
|
||||
|
||||
// Make sure the Knex hook is present since Knex needs it.
|
||||
if (!strapi.hooks.knex) {
|
||||
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.stop(1);
|
||||
}
|
||||
|
||||
// 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.
|
||||
if (!strapi.hooks.external.knex) {
|
||||
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.stop(1);
|
||||
}
|
||||
|
||||
// Initialize collections
|
||||
_.set(strapi, 'bookshelf.collections', {});
|
||||
|
||||
|
||||
@ -63,6 +63,7 @@ module.exports = function (strapi) {
|
||||
cb(err);
|
||||
}
|
||||
}
|
||||
|
||||
return memo;
|
||||
}, {}));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user