When using Sequelize to define the Model model, set the column data type to Sequelize.JSON to always report errors, and the database to ask for help from the bosses for mysql,?

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:

clipboard.png

:


,


,Array, Sequelize

clipboard.png
it seems that only Sequelize.JSON can support mysql, but try or report an error

I hope the bosses will give us some advice!

Oct.13,2021

check your mysql version and support it from 5.7.8 .
mysql


I remember this as long as Postgres is applicable.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3678e-2b37d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3678e-2b37d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?