Why sails-orientdb tries to create a new database every time i start my app?

90 Views Asked by At

I am using sails-orientdb as an Waterline Adapter but there is a problem whenever I restart my application it tries to create a new database which was already created as I am using it for the first time so I don't know the structure and functions and flow of sails-orientdb is it possible to avoid this call?

1

There are 1 best solutions below

0
On

In sails-orientdb there is one property

migrate : This setting controls whether/how Sails will attempt to automatically rebuild the tables/collections/sets/etc. in your schema.

Set these migrate to safe.

In a production environment (NODE_ENV==="production") Sails always uses migrate:"safe" to protect inadvertent deletion of your data. However during development, you have a few other options for convenience:

  1. safe - never auto-migrate my database(s). I will do it myself (by hand)
  2. alter - auto-migrate, but attempt to keep my existing data (experimental)
  3. drop - wipe/drop ALL my data and rebuild models every time I lift Sails

When your sails app lifts, waterline validates all of the data in your database. This flag tells waterline what to do with data when the data is corrupt. You can set this flag to safe which will ignore the corrupt data and continue to lift

See these documentation of Model Settings migrate property