To make Sequelize use singular table names with JavaScript, we set freezeTableName to true.
For instance, we write
const Sequelize = require("sequelize");
const opts = {
define: {
freezeTableName: true,
},
};
const sequelize = new Sequelize(
"mysql://root:123abc@localhost:3306/mydatabase",
opts
);
const Project = sequelize.define("Project", {
title: Sequelize.STRING,
description: Sequelize.TEXT,
});
to create a Sequelize instance with the define.frezeTableName property set toi true to stop table names from being pluralized when they’re created.
Then we call sequelize.definer to create the Project model which is mapped to a table that isn’t pluralized.