models: move Change LDL def into a json file
This commit is contained in:
parent
6cbc231fba
commit
0906a6f5b3
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"name": "Change",
|
||||||
|
"trackChanges": false,
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"rev": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"prev": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"checkpoint": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"modelName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"modelId": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -33,7 +33,9 @@ module.exports = function(loopback) {
|
||||||
require('../common/models/user.json'),
|
require('../common/models/user.json'),
|
||||||
require('../common/models/user.js'));
|
require('../common/models/user.js'));
|
||||||
|
|
||||||
loopback.Change = require('../common/models/change');
|
loopback.Change = createModel(
|
||||||
|
require('../common/models/change.json'),
|
||||||
|
require('../common/models/change.js'));
|
||||||
|
|
||||||
loopback.Checkpoint = createModel(
|
loopback.Checkpoint = createModel(
|
||||||
require('../common/models/checkpoint.json'),
|
require('../common/models/checkpoint.json'),
|
||||||
|
|
|
@ -960,7 +960,10 @@ PersistedModel.enableChangeTracking = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PersistedModel._defineChangeModel = function() {
|
PersistedModel._defineChangeModel = function() {
|
||||||
var BaseChangeModel = require('./../common/models/change');
|
var BaseChangeModel = loopback.Change;
|
||||||
|
assert(BaseChangeModel,
|
||||||
|
'Change model must be defined before enabling change replication');
|
||||||
|
|
||||||
return this.Change = BaseChangeModel.extend(this.modelName + '-change',
|
return this.Change = BaseChangeModel.extend(this.modelName + '-change',
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue