Repository: strapi/strapi
File: packages/core/core/src/domain/content-type/index.ts (TypeScript)

Code before:
    _.set(schema, 'options.draftAndPublish', false); // Disabled by default
  }

  schema.attributes[PUBLISHED_AT_ATTRIBUTE] = {
    type: 'datetime',
    configurable: false,
    writable: true,
    visible: false,
    default() {
      return new Date();
    },
  };
};

const addFirstPublishedAt = (schema: Schema.ContentType) => {
  const isNonPrivate =
    strapi.config.get('admin.firstPublishedAtField.enabled', false) &&
    _.get(schema, 'options.draftAndPublish', false);

  schema.attributes[FIRST_PUBLISHED_AT_ATTRIBUTE] = {
    type: 'datetime',
    configurable: false,
    writable: true,
    visible: false,
    private: !isNonPrivate,
  };
};

const addCreatorFields = (schema: Schema.ContentType) => {
  const isPrivate = !_.get(schema, 'options.populateCreatorFields', false);

  schema.attributes[CREATED_BY_ATTRIBUTE] = {
    type: 'relation',
    relation: 'oneToOne',
    target: 'admin::user',
    configurable: false,
    writable: false,
    visible: false,
    useJoinTable: false,
    private: isPrivate,
  };

  schema.attributes[UPDATED_BY_ATTRIBUTE] = {
    type: 'relation',
    relation: 'oneToOne',
    target: 'admin::user',
    configurable: false,
    writable: false,
    visible: false,
    useJoinTable: false,
    private: isPrivate,

Review comment (suggestion):
```suggestion
  const isEnabled =
    strapi.config.get('admin.firstPublishedAtField.enabled', false) &&
    _.get(schema, 'options.draftAndPublish', false);

  schema.attributes[FIRST_PUBLISHED_AT_ATTRIBUTE] = {
    type: 'datetime',
    configurable: false,
    writable: true,
    visible: false,
    private: !isEnabled,
  };
```

Code after:
    _.set(schema, 'options.draftAndPublish', false); // Disabled by default
  }

  schema.attributes[PUBLISHED_AT_ATTRIBUTE] = {
    type: 'datetime',
    configurable: false,
    writable: true,
    visible: false,
    default() {
      return new Date();
    },
  };
};

const addFirstPublishedAt = (schema: Schema.ContentType) => {
  const isEnabled = contentTypesUtils.hasFirstPublishedAtField(schema);

  // Note: As an expertimental feature, we are okay if this data is deleted if this feature is
  // switched off. Once "preserve_attributes" come into play, this will be updated.
  if (isEnabled) {
    strapi.log.warn(`Experimental feature enabled: firstPublishedAt on ${schema.collectionName}`);
    schema.attributes[FIRST_PUBLISHED_AT_ATTRIBUTE] = {
      type: 'datetime',
      configurable: false,
      writable: true,
      visible: false,
      private: !isEnabled,
    };
  }
};

const addCreatorFields = (schema: Schema.ContentType) => {
  const isPrivate = !_.get(schema, 'options.populateCreatorFields', false);

  schema.attributes[CREATED_BY_ATTRIBUTE] = {
    type: 'relation',
    relation: 'oneToOne',
    target: 'admin::user',
    configurable: false,
    writable: false,
    visible: false,
    useJoinTable: false,
    private: isPrivate,
  };

  schema.attributes[UPDATED_BY_ATTRIBUTE] = {
    type: 'relation',
    relation: 'oneToOne',
    target: 'admin::user',
    configurable: false,
    writable: false,