I'm new to LoopBack4, and I was following the tutorials to generate a simple blog API using LoopBack, and I knew I can use 'migrateSchema' to create database tables using my models.
Just follow the tutorial to generate the simple order, customer model and relationships, and try to run the app after adding the relationship (this link)
When I use npm strat I get this error:
Cannot start the application. TypeError: Cannot read property 'target' of undefined
at resolveBelongsToMetadata (E:\personal\project\node_modules\@loopback\repository\dist\relations\belongs-to\belongs-to-accessor.js:37:54)
at Object.createBelongsToAccessor (E:\personal\project\node_modules\@loopback\repository\dist\relations\belongs-to\belongs-to-accessor.js:16:18)
at StoryRepository.createBelongsToAccessorFor (E:\personal\project\node_modules\@loopback\repository\dist\repositories\legacy-juggler-bridge.js:184:28)
at new StoryRepository (E:\personal\project\node_modules\dist\repositories\story.repository.js:22:26)
https://github.com/m98/loopback4-example/tree/master/src
Windows 10 'win32', 'x64', '10.16.0'
In order to do that, we'll need strong relation with referential integrity which is captured in https://github.com/strongloop/loopback-next/issues/2331.
As a workaround, this documentation page (https://loopback.io/doc/en/lb4/todo-list-tutorial-sqldb.html) showed how to modify the @model decorator to contain the foreign key information when running migrateSchema.
Hope it helps.
Actually, I'm disappointed by loopback documentation, and also errors which are not meaningful, especially when you search them on Google, and you can't find anything meaningful by the loopback error message.
Most helpful comment
Actually, I'm disappointed by loopback documentation, and also errors which are not meaningful, especially when you search them on Google, and you can't find anything meaningful by the loopback error message.