Sails 名称类型返回未定义而不是字符串

Sails name type returning undefined instead of string

我的 sails seed 已配置为在模型下放置名称属性的字符串,但它反而使我的应用程序崩溃。

error: Bootstrap encountered an error: (see below)
error:
error: { UsageError: Invalid initial data for new records.
Details:
  Could not use one of the provided new records: Missing value for required attribute `name`.  Expected a string, but instead, got: undefined
 [?] See https://sailsjs.com/support for help.
    at Object.module.exports.bootstrap (/Users/adarian/learn-sails/config/bootstrap.js:63:14)
  cause:
   { UsageError: Invalid initial data for new records.
   Details:
     Could not use one of the provided new records: Missing value for required attribute `name`.  Expected a string, but instead, got: undefined
    [?] See https://sailsjs.com/support for help.
       at Object.module.exports.bootstrap (/Users/adarian/learn-sails/config/bootstrap.js:63:14)
     name: 'UsageError',
     code: 'E_INVALID_NEW_RECORDS',
     details:
      'Could not use one of the provided new records: Missing value for required attribute `name`.  Expected a string, but instead, got: undefined' },
  isOperational: true,
  code: 'E_INVALID_NEW_RECORDS',
  details:
   'Could not use one of the provided new records: Missing value for required attribute `name`.  Expected a string, but instead, got: undefined' }

我该如何解决这个问题,因为我的种子文件看起来像这样。

 /**
 * Sails Seed Settings
 * (sails.config.seeds)
 *
 * Configuration for the data seeding in Sails.
 *
 * For more information on configuration, check out:
 * http://github.com/frostme/sails-seed
 */
module.exports.seeds = {
  user: [
    {
      name: "John Wayne",
      email: 'johnnie86@gmail.com',
      avatar: 'https://randomuser.me/api/portraits/men/83.jpg',
      location: 'Mombasa',
      bio: 'Spends most of my time at the beach'
    }
  ]
};

我发现问题的原因是 config/model.js 文件列出了 migrate: 'drop',而后者应该是 migrate: 'alter'。我不知道为什么将它设置为 drop 是错误的,但它不适用于 drop 作为选项并且只能与 safealter 一起使用。