Sequelize Unknown column '*.createdAt' in 'field list'

I got the same error when migrating our project from laravel to featherjs. Tables are having column names created_at, updated_at instead of createdat, updatedat. I had to use field name mapping in Sequelize models as given below

  const users = sequelize.define('users', {
     id: {
         type: Sequelize.INTEGER,
         primaryKey: true
     },
     createdAt: {
         field: 'created_at',
         type: Sequelize.DATE,
     },
     updatedAt: {
         field: 'updated_at',
         type: Sequelize.DATE,
     },
     ..
     ..
     ..
     ..

I think the error is that you have timestamps enabled in sequelize, but your actual table definitions in the DB do not contain a timestamp column.

When you do user.find it will just do SELECT user.*, which only takes the columns you actually have. But when you join, each column of the joined table will be aliased, which creates the following query:

SELECT `users`.*, `userDetails`.`userId` AS `userDetails.userId`,`userDetails`.`firstName` AS `userDetails.firstName`,`userDetails`.`lastName` AS `userDetails.lastName`, `userDetails`.`birthday` AS `userDetails.birthday`, `userDetails`.`id` AS `userDetails.id`, `userDetails`.`createdAt` AS `userDetails.createdAt`, `userDetails`.`updatedAt` AS `userDetails.updatedAt` FROM `users` LEFT OUTER JOIN `userDetails` AS `userDetails` ON `users`.`id` = `userDetails`.`userId`;

The fix would be to disable timestamps for either the userDetails model:

var userDetails = sequelize.define('userDetails', {
    userId :Sequelize.INTEGER,
    firstName : Sequelize.STRING,
    lastName : Sequelize.STRING,
    birthday : Sequelize.DATE
}, {
    timestamps: false
});

or for all models:

var sequelize = new Sequelize('sequelize_test', 'root', null, {
    host: "127.0.0.1",
    dialect: 'mysql',
    define: {
        timestamps: false
    }
});