How can I have a datatype of array in mysql Sequelize instance?
You can use getter/setter functions for this:
favColors: {
type: Sequelize.STRING,
allowNull: false,
get() {
return this.getDataValue('favColors').split(';')
},
set(val) {
this.setDataValue('favColors',val.join(';'));
},
}
more info: https://sequelize.org/master/manual/getters-setters-virtuals.html
You can define your field as json
:
type: Sequelize.JSON
And then save the data as an array