Skip to content
This repository was archived by the owner on Mar 4, 2019. It is now read-only.
This repository was archived by the owner on Mar 4, 2019. It is now read-only.

Support for ON CONFLICT #425

@tamlyn

Description

@tamlyn

Postgres 9.5 introduced the ON CONFLICT clause which enables upsert behavior.

Would you be open to a PR to add support for this to Massive as an option on insert? Simplest solution would be to add a second options parameter. e.g.

db.table.insert({id: 'might exist'}, {onConflict: 'do nothing'})
// or
db.table.insert({id: 'might exist'}, {onConflict: 'do update'})

It should be possible to generate the rest of the do update clause automatically.

Alternatively the options could be flags like {ignoreConflict: true} and {upsert: true} respectively.

As mentioned in #278 (comment) this this could also be used for save.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions