0

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?

Satyam Koyani
  • 4,236
  • 2
  • 22
  • 48
  • Please give more details. – Gabriel Tomitsuka Feb 07 '15 at 11:16
  • Ok I am using sails-orientdb as an adapter in waterline I wanted to get and post data in my orientdb database but when i start my server which is node.js application server and its configured with a connection connections: { myLocalOrient: { adapter: 'orient', host: 'localhost', port: 2424, username: 'root', password: 'root', database:'test' } – Zeeshan Haider Feb 07 '15 at 11:29
  • whenever there is a database:test in orientdb already it will throw an error but when there is not a database it will work fine – Zeeshan Haider Feb 07 '15 at 11:30
  • post your adapter config, – Satyam Koyani Apr 02 '15 at 23:54

1 Answers1

1

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

Satyam Koyani
  • 4,236
  • 2
  • 22
  • 48