Have a default value now for date

Hello team,

I have a model with the following field:
verificationDate: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
},

Expected behavior

I would expect the creation of this entity to be prefilled with the current date but it isn’t the case.

Actual behavior

The field is empty. Actually, the model defaultValue has not been propagated to the .forestadmin-schema.json
{
“field”: “verificationDate”,
“type”: “Date”,
“defaultValue”: null,

Context

Please provide any relevant information about your setup.

Forest-express-sequelize: 6.3.11

Is there a way to make this work?

Thanks,
Matthieu

Hello @Matthieu_Vegreville , I hope you are well !

I tried to reproduce your problem locally but without success. In the project I created I have this user model with a verificationDate field (which in database has the type timestamp with time zone) and it generates a date every time I create a new record. Can you give me more information about the associated model with a verificationDate field?

Below is the code of my model user.js

module.exports = (sequelize, DataTypes) => {
  const { Sequelize } = sequelize;
  // This section contains the fields of your model, mapped to your table's columns.
  // Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
  const User = sequelize.define('user', {
    username: {
      type: DataTypes.STRING,
    },
    verificationDate: {
      type: DataTypes.DATE,
      defaultValue: DataTypes.NOW,

    },
  }, {
    tableName: 'user',
    timestamps: false,
    schema: process.env.DATABASE_SCHEMA,
  });

  // This section contains the relationships for this model. See: https://docs.forestadmin.com/documentation/v/v6/reference-guide/relationships#adding-relationships.
  User.associate = (models) => {
  };

  return User;
};