当我运行sequelize-cli命令时发生sequelize db:seed:all
当我尝试将对象作为 JSON 播种时,出现以下错误:
ERROR: Invalid value { viewId: null,
dateRanges: [ { startDate: null, endDate: null } ],
samplingLevel: 'DEFAULT',
dimensions: [ { name: 'ga:channelGrouping' } ],
metrics: [ { expression: 'ga:users' } ] }
Run Code Online (Sandbox Code Playgroud)
这是我的模型
module.exports = (Sequelize, DataTypes) => {
const Report = Sequelize.define('Report', {
name: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
validate: {
is: /^[a-z0-9\_\-]+$/i,
},
},
platform: {
type: DataTypes.STRING,
allowNull: false,
validate: {
is: /^[a-z0-9\_\-]+$/i,
},
},
query: {
type: DataTypes.JSON, …Run Code Online (Sandbox Code Playgroud)