Skip to content

Need a way to exclude automatically generated columns from the update method.  #61

@jayalfredprufrock

Description

@jayalfredprufrock

It's fairly common to use automatically generated columns, i.e. datetimes like created_at and updated_at which knex has good support for. The problem is the knex service won't let you update tables like this, since it automatically includes NULL for those columns. I suppose you could argue PATCH should be used in this case, but I propose another way:

A simple extra option like nonUpdateableColumns that would default to an array of [this.id] could be used to prevent the overwriting of these columns during an update, more of a generalization of what is already being done to the "id" column. A hook really wouldn't work, since you'd have to apply the removal to the GET method, however in just about every other case you would want GET to return those columns. I think building support for this use case into the service makes since. If a maintainer agrees and wants to offer up an option name, I'm happy to create a pull request.

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