sequelize database error relation does not exist code example
Example 1: sequelize relation does not exist
// You need to set freezeTableName to true in the options of the data model
const YourTable = sequelize.define('YourTable', {
...
}, {
freezeTableName: true
});
Example 2: DatabaseError [SequelizeDatabaseError]: relation does not exist
const User = sequelize.define('user', {
firstName: {
type: Sequelize.STRING
},
lastName: {
type: Sequelize.STRING
}
}, {
// disable the modification of table names; By default, sequelize will automatically
// transform all passed model names (first parameter of define) into plural.
// if you don't want that, set the following
freezeTableName: true,
});