type: {
type: DataTypes.STRING,
defaultValue: "Normal"
}
In this type I want to add validation only the type can be "Normal" or "Installment"
I don't want to use enum so how can I do custom validation in sequelize model?
You can add custom validations as mentioned in sequelize docs
You can try like:
type: {
type: DataTypes.STRING,
defaultValue: "Normal",
validate: {
isIn: [['Normal', 'Installment']]
}
}
You can make the column an enum one if your enum values wont change.