简体   繁体   中英

Generating schema with waterline-orientdb

In many of the previous Waterline databases that I've hacked around with, you could create a Waterline/Sails model using the "generic" syntax specified by Waterline/Sails and things would just work. When I started using OrientDB and Waterline-OrientDB there appears to be an issue whereby I have to define my full schema in OrientDB before I am able to persist anything. Is this a requirement for using Waterline-OrientDB or is there something not configured properly about my OrientDB setup which is forcing the schema to be defined first.

If the creation is necessary, how should one model the edges in the OrientDB database and in SailsJS to ensure that the Sails/Waterline ORM will be able to persist properly. I assumed that it would "just work", but throughout the waterline-orientdb documentation are references to calls for creating edges and such. That seems to be a crucial feature from the documentation - what do you HAVE to define, and what can you get away with not defining for SailsJS model objects.

No waterline model definition or config have been provided, so it's hard to pinpoint what the exact issue is. One possible cause is that migrate is set to 'safe' in the config. waterline-orientdb follows the migratable interface and as such it will only create classes when migrate: 'drop' or migrate: 'alter' (waterline deems this as experimental) or migrate: 'create' (in waterline master branch, not released yet). More about setting the migrate options on Sails.js docs - model settings .

Regarding the second paragraph, waterline-orientdb complies 100% to the waterline specification and it passes all API integration tests for Waterline adapters ( results ). Edges are modelled as normal waterline many-to-many associations . The waterline-orientdb documentation follows the example of other adapters as it mostly documents things that are particular to waterline-orientdb, namely extensions made. In other words waterline-orientdb can be used just like any other adapter and these extensions are just to help with specific OrientDB operations.

Let me know if this doesn't fix your issue and feel free to provide examples, I'll look into them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM