Plugin's knex instance should default to the root server's
devinivy opened this issue · comments
This is both,
- when
Model.knexBind()
ing during init and, - when calling
request.knex()
andserver.knex()
.
@devinivy Don't these lines cover this?
https://github.com/BigRoomStudios/schwifty/blob/master/lib/index.js#L176-L179
Yeah, actually it sort of does. I think I really just mean to update the behavior. That sets a special root knex instance as the first knex instance that's specified in any plugin. We would rather not rely on timing– the root knex instance should simply be the knex instance set when,
- registering the plugin, or
- calling
server.schwifty()
whenserver
is the root server.
And it should be able to be specified at any point in time. In short, this feature is really about making sure that "order doesn't matter" when it comes to plugins (and the root server) declaring their knex instances.
Ok cool. So we're leaving it open for the root knex instance to be registered possibly after some plugins have registered. Yeah that whole block can be changed then, and the Hoek.assert can be removed (the one mentioned in description of #9 )
On it