Aller au contenu principal
Version: 2.0.0

Timestamps

Timestamps are output-only fields that ivo populates automatically. Enable them with the timestamps schema option.

Default behavior

With timestamps: true, ivo adds createdAt and updatedAt to every created or updated entity.

Loading playground…

Custom keys

Use an object to rename the fields. updatedAt can also be configured as non-nullable.

new Schema((b) => ..., {
timestamps: {
createdAt: "created_at",
updatedAt: { key: "updated_at", nullable: false },
},
});

Rules

  • Timestamps are ignored if provided as input.
  • createdAt is set once, during creation.
  • updatedAt is set during creation and refreshed on every successful update.
  • Setting updatedAt to false disables the update timestamp while keeping createdAt.