Skip to content

Please add created_at and updated_at as special property declarations in the entity properties (maybe datetime as type?) #2554

Open
@ioweb-gr

Description

@ioweb-gr

Is your feature request related to a problem? Please describe.

I think it's very common to have created_at and updated_at dates in a model's properties to track information about when something was modified or for sorting purposes when retrieving the data.

Currently we have to set them as string but there's also a different issue with them. The save model, when the form submits them will treat them as any other property and save over them.

Usually we need to do extra steps to define them after we create the entity or we need to declare them in the dialog as string and then

  • start modifying the SaveEntityInterface to not tamper with them
  • modify the db_schema.xml to add the correct type and declarations

Describe the solution you'd like (*)

I'd like to be able to set created_at and updated_at properties easily as a field, where the db_schema.xml is properly defining it as timestamp

        <column xsi:type="timestamp" name="created_at" nullable="false" default="CURRENT_TIMESTAMP"
                onCreate="CURRENT_TIMESTAMP" comment="Created At Column"/>
        <column xsi:type="timestamp" name="updated_at" nullable="false" default="CURRENT_TIMESTAMP" on_update="true" comment="Updated At Column"/>

Describe alternatives you've considered

So far there's no better alternative than using string as type and modifying multiple files afterwards

Additional context

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