Skip to content
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

ptch: add x-upsert header to upsert duplicate object #32

Merged
merged 2 commits into from
Jun 21, 2021

Conversation

ankitjena
Copy link
Contributor

What kind of change does this PR introduce?

feature

What is the current behavior?

Closes #21
Currently insert throws a duplicate key error when trying to insert an key that already exists.

What is the new behavior?

Adds a x-upsert header to the insert object api, which upserts the object when the value of the header is true.

Screen recording

Peek 2021-06-20 11-59

@ankitjena ankitjena force-pushed the feat/upsert-object-api branch from 791839a to 1d23047 Compare June 20, 2021 06:37
@inian
Copy link
Member

inian commented Jun 21, 2021

Hey Ankit, this looks good!

There seems to be a type error and can you add tests for the upsert mode too?

@ankitjena
Copy link
Contributor Author

There seems to be a type error and can you add tests for the upsert mode too?

I think upgrading the postgrest-js should fix it. Adding tests for the upsert mode.

@inian
Copy link
Member

inian commented Jun 21, 2021

I think upgrading the postgrest-js should fix it.

Ah cool, lets upgrade postgrest-js also in this PR then.

@ankitjena
Copy link
Contributor Author

Ah cool, lets upgrade postgrest-js also in this PR then.

Should I upgrade it to the latest version, from the repo I see v0.32.0?

@ankitjena ankitjena force-pushed the feat/upsert-object-api branch from 49f5b7c to b4a8913 Compare June 21, 2021 06:40
@inian
Copy link
Member

inian commented Jun 21, 2021

Yup, that version should be fine. I don't think there were any breaking changes.

@ankitjena
Copy link
Contributor Author

The tests are failing for some reason. Not related to the test suites though.

@inian inian merged commit ae83a10 into supabase:master Jun 21, 2021
@inian
Copy link
Member

inian commented Jun 21, 2021

I ran the tests locally and they seem to be fine @ankitjena. I will debug why the Github actions are failing separately. Thanks for your contribution ❤️

@ankitjena
Copy link
Contributor Author

Also @inian Should I create a issue in storage-js repo to support this, for next steps

@inian
Copy link
Member

inian commented Jun 21, 2021

Do you want to help with this too Ankit? supabase/storage-js#7 (comment)

@ankitjena
Copy link
Contributor Author

Do you want to help with this too Ankit? supabase/storage-js#7 (comment)

Sure do

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

Successfully merging this pull request may close these issues.

Support upsert functionality
2 participants