Hi! I have this model structure:
const { Model } = require('sequelize'); module.exports = (sequelize, DataTypes) => { class EncuestaRealizada extends Model { static associate({Usuario, Encuesta}) { this.belongsTo(Usuario, {foreignKey: 'userID', as: 'usuario' }) this.belongsTo(Encuesta, {foreignKey: 'encuestaID', as: 'encuesta' }) // define association here } }; EncuestaRealizada.init({ id: { allowNull: false, autoIncrement: true, primaryKey: true, type: DataTypes.INTEGER }, userID: { allowNull: false, primaryKey: true, type: DataTypes.INTEGER }, encuestaID: { allowNull: false, primaryKey: true, type: DataTypes.INTEGER }, fecha_realizada:{ allowNull: false, type: DataTypes.DATE, } },{ sequelize, //define table name timestamps: false, createdAt:false, updatedAt:false, tableName: 'encuestaRealizada', modelName: 'EncuestaRealizada', }); return EncuestaRealizada; };
it comes from a belongstomany relationship with Usuario and Grupo. When I execute the migration, the resulting table has the columns createdAt and updatedAt, but I am using timestamp: false. The column fecha_realizada is ignored too. What could be the reason?
Here's my package.json
"sequelize": "^6.33.0",
Hi! I have this model structure:
const { Model } = require('sequelize'); module.exports = (sequelize, DataTypes) => { class EncuestaRealizada extends Model { static associate({Usuario, Encuesta}) { this.belongsTo(Usuario, {foreignKey: 'userID', as: 'usuario' }) this.belongsTo(Encuesta, {foreignKey: 'encuestaID', as: 'encuesta' }) // define association here } }; EncuestaRealizada.init({ id: { allowNull: false, autoIncrement: true, primaryKey: true, type: DataTypes.INTEGER }, userID: { allowNull: false, primaryKey: true, type: DataTypes.INTEGER }, encuestaID: { allowNull: false, primaryKey: true, type: DataTypes.INTEGER }, fecha_realizada:{ allowNull: false, type: DataTypes.DATE, } },{ sequelize, //define table name timestamps: false, createdAt:false, updatedAt:false, tableName: 'encuestaRealizada', modelName: 'EncuestaRealizada', }); return EncuestaRealizada; };it comes from a belongstomany relationship with Usuario and Grupo. When I execute the migration, the resulting table has the columns createdAt and updatedAt, but I am using timestamp: false. The column fecha_realizada is ignored too. What could be the reason?
Here's my package.json
"sequelize": "^6.33.0",