Reputation: 2735
I read this similar question: Sequelize Unknown column '*.createdAt' in 'field list'
but the solution doesn't work for me! Why? This is my code:
var User = sequelize.define("User", {
id: {
type: DataTypes.UUID,
primaryKey: true
},
cognome: DataTypes.STRING,
nome: DataTypes.STRING,
email: DataTypes.STRING,
password: DataTypes.TEXT,
stato: DataTypes.INTEGER,
ruolo: DataTypes.INTEGER
}, {
freezeTableName: true
}, {
timestamps: false
});
the error is:
Executing (default): SELECT `id`, `cognome`, `nome`, `email`, `data_nascita`, `password`, `cellulare`, `stato`, `blacklist`, `createdAt`, `updatedAt` FROM `Candidato` AS `Candidato`;
Unhandled rejection SequelizeDatabaseError: ER_BAD_FIELD_ERROR: Unknown column 'createdAt' in 'field list'
Upvotes: 2
Views: 3146
Reputation: 106483
Instead of passing { timestamps: false }
as an additional param of Sequelize.define
call, you should extend the existing (third) one with the corresponding property:
var User = sequelize.define("User", {
// model definition skipped
}, {
freezeTableName: true,
timestamps: false
});
... as it described in the docs.
Upvotes: 4