Sequelize Error on DataTypes.ARRAY(DataTypes.STRING)

Viewed 2470

I am new to NodeJs development I am using NodeJs with mysql and Sequelize to create a Batch model with these properties.

const Batch = sequelize.define(
  "Batch",
  {
    title: { type: DataTypes.STRING, allowNull: false },
    studentIds: { type: DataTypes.STRING },
    teacherId: { type: DataTypes.STRING, allowNull: true }
  },
  {
    timestamps: false
  }
);

On async method call it is working fine.

Batch.sync().then((res) => {
  console.log("Batch model sync : ", Batch === sequelize.models.Batch);
});

But I need to change

studentIds: { type: DataTypes.ARRAY(DataTypes.STRING)}

Whenever I make this change it gives error

enter image description here

I am using node 14.5.0 MySql 8.0.21 and Sequelize 6.3.4

1 Answers
Related