problem description
uses node.js "s ORM framework Sequelize to operate the database, defines the model model through sequelize.define ()
, and then sets the data type of the column data field to DataType to Sequelize.JSON,. After setting it to sequelize.sync ({force: true})
after initializing the database, the console prompts you to report an error
related codes
const Sequelize = require("sequelize")
const db = require("../db")
// model
module.exports = db.defineModel("comments", {
pid: Sequelize.STRING(50),
title: Sequelize.STRING(50),
content: Sequelize.STRING(255),
username: Sequelize.STRING(50),
userid: Sequelize.STRING(50),
avatar: {
type: Sequelize.STRING(100),
allowNull: true
},
replyArr: {
type: Sequelize.JSON // JSON . PostgreSQL, SQLite and MySQL.
}
})
the error in the console is as follows:
:
,
,Array, Sequelize
it seems that only Sequelize.JSON can support mysql, but try or report an error
I hope the bosses will give us some advice!