我的数据库记录被删除(带有风帆)

时间:2021-11-20 10:33:51

Sometimes I see that my database is empty, but I don't remove anything.

有时我看到我的数据库是空的,但我没有删除任何东西。

I am using Sails with MongoDB and I don't know why this is happening.

我正在使用Sails与MongoDB,我不知道为什么会发生这种情况。

1 个解决方案

#1


0  

it really depend on ./config/models.js file.

它真的取决于./config/models.js文件。

module.exports.models = {

  /***************************************************************************
  *                                                                          *
  * Your app's default connection. i.e. the name of one of your app's        *
  * connections (see `config/connections.js`)                                *
  *                                                                          *
  ***************************************************************************/
  //connection: 'localMysqlServer',

  /***************************************************************************
  *                                                                          *
  * How and whether Sails will attempt to automatically rebuild the          *
  * tables/collections/etc. in your schema.                                  *
  *                                                                          *
  * See http://sailsjs.org/#/documentation/concepts/ORM/model-settings.html  *
  *                                                                          *
  ***************************************************************************/
  migrate: 'alter',
  schema : true,
  autoPK: true,
  autoCreatedAt: true,
  autoUpdatedAt: true

};

migrate key is very important and make sure in production it set to 'safe' then it not modify the data of database.

迁移密钥非常重要,并确保在生产中它设置为“安全”,然后它不会修改数据库的数据。

#1


0  

it really depend on ./config/models.js file.

它真的取决于./config/models.js文件。

module.exports.models = {

  /***************************************************************************
  *                                                                          *
  * Your app's default connection. i.e. the name of one of your app's        *
  * connections (see `config/connections.js`)                                *
  *                                                                          *
  ***************************************************************************/
  //connection: 'localMysqlServer',

  /***************************************************************************
  *                                                                          *
  * How and whether Sails will attempt to automatically rebuild the          *
  * tables/collections/etc. in your schema.                                  *
  *                                                                          *
  * See http://sailsjs.org/#/documentation/concepts/ORM/model-settings.html  *
  *                                                                          *
  ***************************************************************************/
  migrate: 'alter',
  schema : true,
  autoPK: true,
  autoCreatedAt: true,
  autoUpdatedAt: true

};

migrate key is very important and make sure in production it set to 'safe' then it not modify the data of database.

迁移密钥非常重要,并确保在生产中它设置为“安全”,然后它不会修改数据库的数据。