这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rakeshkky
Copy link
Member

@rakeshkky rakeshkky commented Oct 3, 2019

Description

Support where clause in on_conflict input object. It is optional. This where condition applies to old data.

For more details, refer to issue #2795

Affected components

  • Server
  • Docs
  • Tests

Related Issues

closes #2795

Solution and Design

  • Generate nullable where field in on_conflict input object
    on_conflict: {
      constraint: table_constraint!
      update_columns: [table_update_column!]!
      where: table_bool_exp
    }
  • Resolve the where field using text encoding of input values.
  • Join the obtained boolean expression from where with update filter using AND operator

Steps to test and verify

Follow any test case added in this PR

@netlify
Copy link

netlify bot commented Oct 3, 2019

Deploy preview for hasura-docs ready!

Built with commit 4d4b506

https://deploy-preview-3002--hasura-docs.netlify.com

@hasura-bot
Copy link
Contributor

Review app for commit 86ed944 deployed to Heroku: https://hge-ci-pull-3002.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3002-86ed9449

@rakeshkky rakeshkky force-pushed the issue-2795-where-on-conflict branch from 86ed944 to cc423c2 Compare October 4, 2019 10:54
@hasura-bot
Copy link
Contributor

Review app for commit cc423c2 deployed to Heroku: https://hge-ci-pull-3002.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3002-cc423c2e

@rakeshkky rakeshkky self-assigned this Oct 4, 2019
@rakeshkky rakeshkky added c/server Related to server k/enhancement New feature or improve an existing feature labels Oct 4, 2019
@rakeshkky rakeshkky marked this pull request as ready for review October 4, 2019 11:08
Copy link
Contributor

@lexi-lambda lexi-lambda left a comment

Choose a reason for hiding this comment

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

LGTM aside from a couple minor comments.

marionschleifer
marionschleifer previously approved these changes Oct 6, 2019
Copy link
Contributor

@marionschleifer marionschleifer left a comment

Choose a reason for hiding this comment

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

@lexi-lambda said everything 🙂

Update selected columns on conflict using a filter
--------------------------------------------------
Insert a new object in the ``article`` table, or if the primary key constraint ``article_pkey`` is violated, update
the columns specified in ``update_columns`` only if provided the ``where`` condition is met:
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, this was my fault—I told you the wrong thing. The “the” in this sentence should come before the word “provided,” so it should read “update the columns specified in update_columns only if the provided where condition is met.” I’ve made the change myself, though, so you don’t have to worry about it.

@hasura-bot
Copy link
Contributor

Review app for commit 4d4b506 deployed to Heroku: https://hge-ci-pull-3002.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3002-4d4b5060

@lexi-lambda lexi-lambda merged commit f3b418c into hasura:master Oct 9, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-3002.herokuapp.com is deleted

polRk pushed a commit to polRk/graphql-engine that referenced this pull request Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server k/enhancement New feature or improve an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support where clause parameter on insert mutation on_conflict

4 participants