Skip to content

Commit d0c26e6

Browse files
Tom KirkpatrickTom Kirkpatrick
authored andcommitted
feat: update to support both loopback 3.x and 2.x
1 parent cf41441 commit d0c26e6

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

lib/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ module.exports = function(app, options) {
3838
migrationModelSettings.acls = migrationMapModelSettings.acls = options.acls;
3939
}
4040

41+
// Support for loopback 2.x.
42+
if (app.loopback.version.startsWith(2)) {
43+
Object.keys(migrationModelSettings.methods).forEach(key => {
44+
migrationModelSettings.methods[key].isStatic = true;
45+
});
46+
}
47+
4148
debug('Creating Migration model using settings: %o', migrationModelSettings);
4249
var MigrationModel = dataSource.createModel(
4350
migrationDef.name,

lib/models/migration.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var debug = require('debug')('loopback-component-migrate');
44
var path = require('path');
55
var fs = require('fs');
66
var assert = require('assert');
7-
var utils = require('loopback-datasource-juggler/lib/utils');
7+
var utils = require('loopback/lib/utils');
88
var util = require('util');
99

1010
module.exports = function(Migration, options) {
Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
{
22
"restApiRoot": "/api",
3-
"host": "localhost",
3+
"host": "0.0.0.0",
44
"port": 3000,
5+
"remoting": {
6+
"context": false,
7+
"rest": {
8+
"normalizeHttpPath": false,
9+
"xml": false
10+
},
11+
"json": {
12+
"strict": false,
13+
"limit": "100kb"
14+
},
15+
"urlencoded": {
16+
"extended": true,
17+
"limit": "100kb"
18+
},
19+
"cors": false
20+
},
521
"legacyExplorer": false
622
}

0 commit comments

Comments
 (0)