-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upsert support #13
Comments
You are right we should add this, however cannot give a deadline for this now... :/ |
Sorry for the delay,
would work for you? |
Looks, good, but I don't like the api in the second example. I would rather make the "constraint" variant a bit more explicit and pass in the constraint name as an options object, i.e.: await users.upsert({username: 'bob', password:'123'}, {constraint: "users_name_key"}); or await users.upsert({username: 'bob', password:'123'}, {uniqueConstraint: "users_name_key"}); Just makes this a bit more explicit and distinguishable from the column names variant. |
I've committed a new version, it still uses the original suggestion but it can change of course (before we add it to the documentation). I like the explicit things, however in this case is it needed? It looks like just makes the line longer.
the benefit would be however that we could add the |
Changed to the recommendation. Thanks a lot!
|
I don't think it makes the line that much longer, especially if it's just |
Absolutely make sense. |
Hi I'm looking into upsert support for pogi.
API wise it could be either a seperate method like
upsert
andupsertAndGet
or just an additional parameter on the existinginsert
andinsertAndGet
methods.Postgres 9.5+ has native upsert support via the
ON CONFLICT DO UPDATE
clause which can be appended to inserts, see: https://www.postgresql.org/docs/9.5/static/sql-insert.htmlWhat do you think of adding support for upsert into pogi?
The text was updated successfully, but these errors were encountered: