diff --git a/lib/index.js b/lib/index.js index 54b1d3a..12760db 100644 --- a/lib/index.js +++ b/lib/index.js @@ -38,6 +38,13 @@ module.exports = function(app, options) { migrationModelSettings.acls = migrationMapModelSettings.acls = options.acls; } + // Support for loopback 2.x. + if (app.loopback.version.startsWith(2)) { + Object.keys(migrationModelSettings.methods).forEach(key => { + migrationModelSettings.methods[key].isStatic = true; + }); + } + debug('Creating Migration model using settings: %o', migrationModelSettings); var MigrationModel = dataSource.createModel( migrationDef.name, diff --git a/lib/models/migration.js b/lib/models/migration.js index 527faaa..b1bab07 100644 --- a/lib/models/migration.js +++ b/lib/models/migration.js @@ -4,7 +4,7 @@ var debug = require('debug')('loopback-component-migrate'); var path = require('path'); var fs = require('fs'); var assert = require('assert'); -var utils = require('loopback-datasource-juggler/lib/utils'); +var utils = require('loopback/lib/utils'); var util = require('util'); module.exports = function(Migration, options) { diff --git a/test/fixtures/simple-app/server/config.json b/test/fixtures/simple-app/server/config.json index 275dfa2..1860ede 100644 --- a/test/fixtures/simple-app/server/config.json +++ b/test/fixtures/simple-app/server/config.json @@ -1,6 +1,22 @@ { "restApiRoot": "/api", - "host": "localhost", + "host": "0.0.0.0", "port": 3000, + "remoting": { + "context": false, + "rest": { + "normalizeHttpPath": false, + "xml": false + }, + "json": { + "strict": false, + "limit": "100kb" + }, + "urlencoded": { + "extended": true, + "limit": "100kb" + }, + "cors": false + }, "legacyExplorer": false }