Field createdAt is not populated while creating an entity with content-manager API in test environment

System Information
  • Strapi Version: 4.12.6
  • Operating System: Mac Os
  • Database: MySql / Sqlite
  • Node Version: >=14.19.1 <=18.x.x
  • NPM Version: >=6.0.0
  • Yarn Version:

When I try to create a new entity by calling endpoint api/content-manager/collection-types/api::text.text in production/development env, an entity is created, and the field createdAt is populated. However, calling the same endpoint with the same request payload in test env results in createdAt being null. Why is that so?

Tracing the call stack, I came across this piece of code at entity-service, which makes all the difference:

let entity = await db.query(uid).create({
    ...query,
    data: entityData,
});

Replacing SQLite with MySql as the testing db solved the issue.