SpoonX/wetland

TypeError: Cannot read property 'dropForeign' of undefined

Closed this issue · 1 comments

ppvg commented
# wetland migrator create initial -d

  Error: Unexpected error!

TypeError: Cannot read property 'dropForeign' of undefined
    at Reflect.ownKeys.forEach.property (./node_modules/wetland/dist/src/SnapshotManager.js:322:69)
    at Array.forEach (native)
    at diff.drop.forEach.entity (./node_modules/wetland/dist/src/SnapshotManager.js:303:40)
    at Array.forEach (native)
    at SnapshotManager.diff (./node_modules/wetland/dist/src/SnapshotManager.js:297:19)
    at SchemaManager.prepare (./node_modules/wetland/dist/src/SchemaManager.js:65:37)
    at SchemaManager.getCode (./node_modules/wetland/dist/src/SchemaManager.js:31:21)
    at snapshot.fetch.then.previous (./node_modules/wetland/dist/bin/wetland-migrator.js:42:24)
    at tryCatcher (./node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (./node_modules/bluebird/js/release/promise.js:510:31)
    at Promise._settlePromise (./node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (./node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (./node_modules/bluebird/js/release/promise.js:691:18)
    at Async._drainQueue (./node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (./node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (./node_modules/bluebird/js/release/async.js:17:14)

wetland.json:

{
  "entityPath": "./entities"
}

entities/Parent.js:

module.exports = class Parent {
  static setMapping (mapping) {
    mapping.forProperty('id').primary().increments();
    mapping
      .forProperty('children')
      .oneToMany({ targetEntity: 'Child', mappedBy: 'parent' });
  }
}

entities/Child.js:

module.exports = class Child {
  static setMapping (mapping) {
    mapping.forProperty('id').primary().increments();
    mapping
      .forProperty('parent')
      .manyToOne({ targetEntity: 'Parent', inversedBy: 'children' });
  }
}

I can't reproduce this. I'll assume this is fixed in the last (upcoming) version and close this