createdAt in postgres table becomes "do not exist" in SELECT

508 Views Asked by At

In the nodejs app, there is a pq 11 database created. I notice that createdAt can not be selected via SQL as do not exist even though the field is listed on pgadmin v4:

enter image description here

The Tag table was created with sequelize 6.3 with the code below:

const Sql = require('sequelize');
const db = require("../startup/db");
const util = require("./util/util");
const Model = Sql.Model;

class Tag extends Model {};

Tag.init({
    name: {
        type:Sql.STRING,
        allowNull:false
    },
    type:{  //type is the same as in arworks table
        type:Sql.STRING,
        allowNull:false,
    },
    created_by_id: {type:Sql.INTEGER},
    createdAt:Sql.DATE,
}, {
    sequelize:db,
    modelName: 'tag',
    updatedAt: false,
    indexes: [
        {fields:['name']},
        {fields:['created_by_id']},
        {fields: ['type']},
        {fields: ['createdAt']}
    ]
});

The table was working find as far as I noticed and there hasn't been change with the database. There is same problem with both createdAt and updatedAt with other tables as well. What's the problem here?

0

There are 0 best solutions below