I am creating a test for my models, now my scenario is I want to insert to a table with a column/field that is not defined on my Sequelize
schema.
Here is my sample for my schema
class ResploginSchema extends Sequelize.Model { }
ResploginSchema.init(
{
resploginID: {
type: Sequelize.BIGINT(20).UNSIGNED,
autoIncrement: true,
primaryKey: true,
allowNull: false
},
clientID: {
type: Sequelize.INTEGER(10).UNSIGNED,
allowNull: false,
validate: {
isNumeric: true
}
},
tablelimitID: {
type: Sequelize.TINYINT(2).UNSIGNED,
allowNull: false
},
errMsgID: {
type: Sequelize.INTEGER(6).UNSIGNED,
allowNull: false
}
},
{
sequelize: dbConnection,
modelName: "resplogin",
freezeTableName: true,
timestamps: false
}
);
Here is the sample data I want to insert
let data = {
clientID: 1,
sessionID: "not defined field",
tablelimitID: 1,
errMsgID: 0
};
ResploginSchema.create(data)
I was expecting that it should return an error saying that the sessionID is not defined on the model definition.
Maybe I missed some configuration on the model. Thanks in advance
Sequelize version : 5.21.3
Node Version : 10.14.2