hasura / ra-data-hasura

react-admin data provider for Hasura GraphQL Engine
MIT License
336 stars 70 forks source link

Feature/update by pk #169

Closed franzwilhelm closed 4 months ago

franzwilhelm commented 6 months ago

Today the data provider is using the update many query in hasura to update single entries. This led to a critical bug in production for one of the companies I'm developing for, where all records were updated. This is because update many actually runs without the id column in the where clause being present!

With update_resource_by_pk hasura actually requires the pk_columns to be set, and this behaviour is no longer possible.

Also update by pk is more db-efficient and should lead to easier graphql debugging for anyone experiencing issues.

NOTE: this should be considered a minor version, as it has the potential to break existing implementations that are extending the package with custom buildVariables for the UPDATE queries

franzwilhelm commented 6 months ago

@praveenweb or @arjunyel could you have a look at this?

franzwilhelm commented 5 months ago

@praveenweb @arjunyel ??