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

Add onConflictIgnore option for INSERT #436

Merged
merged 2 commits into from
Aug 2, 2017
Merged

Add onConflictIgnore option for INSERT #436

merged 2 commits into from
Aug 2, 2017

Conversation

tamlyn
Copy link
Contributor

@tamlyn tamlyn commented Aug 1, 2017

As discussed in #425, this adds a boolean onConflictIgnore option to append an ON CONFLICT DO NOTHING clause to a generated INSERT statement.

The ON CONFLICT UPDATE variant is a bit more involved so I thought I'd push this first to get some feedback.

Where should these options be documented?

@dmfay
Copy link
Owner

dmfay commented Aug 1, 2017

docs/persistence.md under insert, and please add an entry to the table in docs/options.md. Don't worry about the README, I've been trying to trim that down and it really doesn't need to be exhaustive. The change looks good other than the documentation!

| offset | `SELECT` | Set the number of rows to skip. |
| only | `SELECT`, `UPDATE`, `DELETE` | Set to `true` to restrict the query to the table specified, if any others inherit from it. |
| order | `SELECT` | An array of strings (`['column1', 'column2 DESC']`) which is processed into an `ORDER BY` clause. |
| orderBody | `SELECT` | If querying a document table, set to `true` to apply `options.order` to fields in the document body rather than the table. |
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added spaces to align columns.

@@ -154,11 +154,11 @@ Massive.prototype.reload = function () {
/**
* Execute a query.
*
* @param {Select|Insert|Update|Delete|String} - One of the four statement
* @param {Select|Insert|Update|Delete|String} query - One of the four statement
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDE was complaining about missing param name.

@tamlyn
Copy link
Contributor Author

tamlyn commented Aug 2, 2017

Docs updated.

@dmfay
Copy link
Owner

dmfay commented Aug 2, 2017

oh nice work, thanks!

@dmfay dmfay merged commit 9cdcf7f into dmfay:master Aug 2, 2017
@tamlyn
Copy link
Contributor Author

tamlyn commented Aug 2, 2017

Not at all! It's a joy to contribute to a project with such a helpful and responsive maintainer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants