Skip to content

Support timestamps #354

@josevalim

Description

@josevalim

The goal of this task is to provide automatic management of created_at and updated_at for models. it consists of three changes.

Schemas

Schemas will automatically generate inserted_at and updated_at fields. @timestamps false can be set before the schema/2 to avoid generating timestamps and @timestamps Type can be used to give the generated timestamps a custom time.

Migrations

Migrations will automatically generate inserted_at and updated_at fields. timestamps: false can be given to table/2 to not generate a timestamp or customize its type.

Ecto.Model.Timestamps

Ecto.Model.Timestamps will include a before_insert and a before_update callback into the model that automatically sets the inserted_at and updated_at values if such fields exist in the model and are not set in the changeset.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions