Skip to content

Commit 01177a1

Browse files
authored
Merge pull request #2 from BoolJS/develop
Expose models via constructor
2 parents 30a5878 + 0a245d0 commit 01177a1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ module.exports = class BoolJSMySQL extends DatabaseLoader {
2828

2929
async fetchModels (instance, name, Component, connection) {
3030
const app = instance.getComponents();
31+
const { models } = this;
3132

32-
const args = [ null, app, { connection, Sequelize } ];
33+
const args = [ null, app, { connection, Sequelize, models } ];
3334

3435
const SchemaClass = Function.prototype.bind.apply(Component, args);
3536
const schemaInstance = new SchemaClass();
3637
const schema = schemaInstance.__schema;
3738

38-
this.models[name] = schema;
39+
models[name] = schema;
3940

4041
if (Component.associations !== undefined &&
4142
typeof Component.associations === 'function') {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@booljs/sequelize",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Sequelize driver for BoolJS",
55
"main": "index.js",
66
"license": "GPL-3.0",

0 commit comments

Comments
 (0)