To make Sequelize table without column ‘id’ with Node.js, we call the removeAttribute
method.
For instance, we write
AcademyModule = sequelize.define(
"academy_module",
{
academy_id: DataTypes.INTEGER,
module_id: DataTypes.INTEGER,
module_module_type_id: DataTypes.INTEGER,
sort_number: DataTypes.INTEGER,
requirements_id: DataTypes.INTEGER,
},
{
freezeTableName: true,
}
);
AcademyModule.removeAttribute("id");
to define the AcademyModule
model with define
.
We map it to the academy_module
table in the database.
We call removeAttribute
to remove the id
column.