Skip to content

Deprecate upsert? #796

@MaxGabriel

Description

@MaxGabriel

The upsert function inserts or updates an existing record. It works fine if there's one uniqueness constraint, but if there are two it doesn't know which to use, and throws an exception. This is pretty lame: you wouldn't think that adding a new uniqueness constraint would cause a runtime exception in a related area of your code. Users should just use upsertBy, or if their database supports a way of not specifying it, use that functionality (e.g. the MySQL module exposes insertOnDuplicateKeyUpdate; I think Postgres requires specifying the column(s)).

This would resolve issues like #768 and avoid all the documentation of this caveat in #785.

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