-
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.
Introduce v2 of auto-generated mutations (#513)
### What v2 of auto-generated mutations introduces point delete, insert and update point mutations that include permission arguments. ### Interface and Design * We generate delete, insert and update procedures for each table. * A single insert procedure is generated per table of the form: ```graphql v2_insert_<table>( objects: [<object>], post_check: <boolexpr> ) ``` It allows us to insert multiple objects and include a post check for permissions. * A delete procedure is generated per table X unique constraint of the form: ```graphql v2_delete_<table>_by_<column_and_...>( key_<column1>: <value>, key_<column2>: <value>, ..., pre_check: <boolexpr> ) ``` It allows us to delete a single row using the uniqueness constraint, and contains a boolexpr for permissions. * An update procedure is generated per table X unique constraint of the form: ```graphql v2_update_<table>_by_<column_and_...>( key_<column1>: <value>, key_<column2>: <value>, ..., update_columns: { <column>: { _set: <value> }, ... }, pre_check: <boolexpr>, post_check: <boolexpr> ) ``` It allows us to update a single row using the uniqueness constraint by updating the relevant columns, and contains a pre check and post check for permissions. * 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 and trace a warning 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_`. ### How - We replace the current `experimental` version of mutations almost word for word (the only different is the names of the procedures, prefixing `v2` instead of `experimental`) to a new directory `v2`. - We add a new mutations version: `v2`. - We replace the `experimental` version of ndc-spec schema generation as well. - We fix the tests to use v2 instead. - experimental version is also removed from configuration version3 completely.
- Loading branch information
Gil Mizrahi
authored
Jun 28, 2024
1 parent
c9bf0d4
commit 4bfdad0
Showing
69 changed files
with
2,664 additions
and
2,680 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1557,7 +1557,7 @@ expression: schema | |
"type": "string", | ||
"enum": [ | ||
"v1", | ||
"veryExperimentalWip" | ||
"v2" | ||
] | ||
} | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,5 @@ | |
#[derive(Debug, PartialEq, Eq, Clone, Copy)] | ||
pub enum MutationsVersion { | ||
V1, | ||
VeryExperimentalWip, | ||
V2, | ||
} |
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
2 changes: 1 addition & 1 deletion
2
crates/query-engine/translation/src/translation/mutation/mod.rs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
pub mod check_columns; | ||
pub mod experimental; | ||
pub mod generate; | ||
pub mod translate; | ||
pub mod v1; | ||
pub mod v2; | ||
|
||
pub use translate::translate; |
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
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
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
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.