From a72e5d83ae652c2d3ccde934ce3626afc960295f Mon Sep 17 00:00:00 2001 From: Niels van Galen Last Date: Sun, 1 May 2016 18:33:37 -0700 Subject: [PATCH] updated build --- lib/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 6a44193..7a12401 100644 --- a/lib/index.js +++ b/lib/index.js @@ -170,7 +170,7 @@ exports.default = function (sequelize, options) { this.addHook("afterUpdate", afterHook); // create association - this.hasMany(sequelize.models.Revision, { + this.hasMany(sequelize.models[options.revisionModel], { foreignKey: "document_id", constraints: false, scope: { @@ -286,7 +286,7 @@ exports.default = function (sequelize, options) { d.save().then(function (d) { // Add diff to revision - revision.addRevisionChange(d); + revision['add' + options.revisionChangeModel](d); return null; }).catch(function (err) { log('RevisionChange save error'); @@ -372,6 +372,7 @@ exports.default = function (sequelize, options) { var RevisionChange = sequelize.define(options.revisionChangeModel, attributes, { underscored: options.underscored }); + // Set associations Revision.hasMany(RevisionChange, { foreignKey: options.defaultAttributes.revisionId,