-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### What We want to make the api for mutations pretty. We make the following changes: 1. Rename arguments 2. prefix the argument names of unique constraint columns with `key_` ### How #### General design * We generate delete, insert and update procedures for each table. * A single insert procedure is generated per _table_ of the form: ```graphql <mutation-version>_insert_<table>( objects: [<object>], post_check: <boolexpr> ) ``` It lets us insert multiple objects and include a post check for permissions. * A delete procedure is generated per _table X unique constraint_ of the form: ```graphql <mutation-version>_delete_<table>_by_<column_and_column_and...>( key_<column1>: <value>, key_<column2>: <value>, ..., pre_check: <boolexpr> ) ``` It lets us delete a single row using the uniqueness constraint, and contains a pre check for permissions. * An update procedure is generated per _table X unique constraint_ of the form: ```graphql <mutation-version>_update_<table>_by_<column_and_column_and...>( key_<column1>: <value>, key_<column2>: <value>, ..., update_columns: { <column>: { _set: <value> }, ... }, pre_check: <boolexpr>, post_check: <boolexpr> ) ``` It lets us update a single row using the uniqueness constraint by updating the relevant columns, and contains a pre check and post check for permissions. Note that the `update_columns` structure is different than the v2 version where we had `_set`, `_inc`, and other fields. * Mutations using uniqueness constraints use the naming schema `by_column_and_column_and_column` instead of the db constraint name, because the former is far more helpful. * If generating a mutation encounters an internal error, we skip that particular mutation instead of throwing an error so the connector can start at any situation. * Naming collisions between the unique constraints and the update_columns / pre_check / post_check is avoided by prefixing argument names of the columns of a unique constraint with `key_`. --------- Co-authored-by: Samir Talwar <samir.talwar@hasura.io>
- Loading branch information
1 parent
7fa6c56
commit 097a4e9
Showing
19 changed files
with
333 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.