Have renamed a table from users
to user
in MySQL database. In Express
I'm running Sequelize
and created a schema for the old users
table. With the table renamed and everything in the code changed from users
to user
, Sequelize
is still looking for a table named specifically users
even though the table name is updated in the schema.
User = db.sequelize.define('user', {
first_name: Sequelize.STRING,
last_name: Sequelize.STRING,
email: Sequelize.STRING,
password: Sequelize.STRING,
role: Sequelize.STRING,
created_at: Sequelize.DATE,
updated_at: Sequelize.DATE
});
Tried running this to overwrite the table with one produced by Sequelize
and it still created a table named users
User.sync({force: true}).then(() => {
// Table created
return User.create({
firstName: 'test',
lastName: 'test',
email: 'test@example.com',
password: 'password'
});
});
Has anyone else experienced the same? Is there some other configuration I am missing? This is all I did in the first place when creating the first table.