I can't seem to understand why my Sequelize timestamps are not turning off despite following the documentation notes. I've tried setting this in the model definition and in the Sequelize definition so its database wide.
I try running a findAll query and I keep getting this error:
Executing (default): SELECT 1+1 AS result
Database connection has been established successfully.
Executing (default): SELECT "contact_id", "first_name",
"last_name","contact_type_id", "org_name", "created_at",
"updated_at", "createdAt","updatedAt" FROM "contacts" AS
"contacts";
Unhandled rejection SequelizeDatabaseError:
column "createdAt" does not exist
Of course it does not exist, I am trying to turn it off.
Anyway, here is my model definition and my Sequelize definition:
contact.js
const Sequelize = require('sequelize');
var Model = Sequelize.Model;
module.exports = (sequelize, DataTypes) => {
const Contact = sequelize.define('contacts', {
contact_id: {
type: Sequelize.INTEGER,
field: 'contact_id',
primaryKey: 'true'
},
first_name: {
type: Sequelize.STRING,
field: 'first_name'
},
[...] //condensed for legibility
created_at: {
type: Sequelize.DATE,
field: 'created_at'
},
updated_at: {
type: Sequelize.DATE,
field: 'updated_at'
}
},
{
// Options
tableName: 'contacts',
timestamps: 'false'
}
);
return Contact;
};
models\index.js
var fs = require('fs');
var path = require('path');
var Sequelize = require('sequelize');
var basename = path.basename(__filename);
var db = {};
const sequelize = new Sequelize(process.env.DB, process.env.DB_USER,
process.env.DB_PASS, {
host: xxxxxxxx,
dialect: 'postgres',
protocol: 'postgres',
freezeTableName: 'true'
});
[...] // condensed for legibility
db.sequelize = sequelize;
db.Sequelize = Sequelize;
module.exports = db;
Any insight anyone can provide? I've already restart the server a handful of times - both the backend and the front end.