diff --git a/changelog.md b/changelog.md index 39ae8cfd..2ba27fa9 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,8 @@ ### Added +- Support auto-generating insert procedures v1 + ([#261](https://github.com/hasura/ndc-postgres/pull/261)) - Return the generated SQL of an explain request with empty variables ([#241](https://github.com/hasura/ndc-postgres/pull/241)) - Emit invalid request, constraint not met, and unprocessable content errors at the relevant scenarios diff --git a/crates/connectors/ndc-postgres/src/configuration/version2.sql b/crates/connectors/ndc-postgres/src/configuration/version2.sql index f14c0cc3..56715464 100644 --- a/crates/connectors/ndc-postgres/src/configuration/version2.sql +++ b/crates/connectors/ndc-postgres/src/configuration/version2.sql @@ -99,12 +99,14 @@ WITH WHEN att.attidentity = 'a' THEN 'identityAlways' ELSE 'notIdentity' END - AS is_identity - -- skipped because yugabyte is based on pg11 that does not have this field. - -- CASE WHEN att.attgenerated = 's' THEN 'isGenerated' ELSE 'notGenerated' END - -- AS is_generated + AS is_identity, + CASE WHEN attgenerated_exists + THEN CASE WHEN attgenerated::text = 's' THEN 'stored' ELSE 'notGenerated' END + ELSE 'notGenerated' + END as is_generated FROM pg_catalog.pg_attribute AS att + CROSS JOIN (SELECT current_setting('server_version_num')::int >= 120000) AS attgenerated(attgenerated_exists) WHERE -- We only include columns that are actually part of the table currently. NOT att.attisdropped -- This table also records historic columns. @@ -854,8 +856,8 @@ FROM c.has_default, 'isIdentity', c.is_identity, - -- 'isGenerated', - -- c.is_generated, + 'isGenerated', + c.is_generated, 'description', comm.description ) diff --git a/crates/connectors/ndc-postgres/src/schema.rs b/crates/connectors/ndc-postgres/src/schema.rs index 957479e4..3176cbc0 100644 --- a/crates/connectors/ndc-postgres/src/schema.rs +++ b/crates/connectors/ndc-postgres/src/schema.rs @@ -9,7 +9,7 @@ use super::configuration; use ndc_sdk::connector; use ndc_sdk::models; use query_engine_metadata::metadata; -use query_engine_translation::translation::mutation::{delete, generate}; +use query_engine_translation::translation::mutation::{delete, generate, insert}; /// Get the connector's schema. /// @@ -252,16 +252,18 @@ pub async fn get_schema( }) .collect(); + let mut more_object_types = BTreeMap::new(); let generated_procedures: Vec = query_engine_translation::translation::mutation::generate::generate( &metadata.tables, &config.mutations_version, ) .iter() - .map(|(name, mutation)| mutation_to_procedure(name, mutation)) + .map(|(name, mutation)| mutation_to_procedure(name, mutation, &mut more_object_types)) .collect(); procedures.extend(generated_procedures); + object_types.extend(more_object_types); Ok(models::SchemaResponse { collections, @@ -294,9 +296,16 @@ fn type_to_type(typ: &metadata::Type) -> models::Type { } /// Turn our different `Mutation` items into `ProcedureInfo`s to be output in the schema -fn mutation_to_procedure(name: &String, mutation: &generate::Mutation) -> models::ProcedureInfo { +fn mutation_to_procedure( + name: &String, + mutation: &generate::Mutation, + object_types: &mut BTreeMap, +) -> models::ProcedureInfo { match mutation { generate::Mutation::DeleteMutation(delete) => delete_to_procedure(name, delete), + generate::Mutation::InsertMutation(insert) => { + insert_to_procedure(name, insert, object_types) + } } } @@ -330,3 +339,65 @@ fn delete_to_procedure(name: &String, delete: &delete::DeleteMutation) -> models } } } + +/// Create an ObjectType out of columns metadata. +fn make_object_type( + columns: &BTreeMap, +) -> models::ObjectType { + let mut fields = BTreeMap::new(); + for (name, column) in columns { + match column { + // columns that are generated or are always identity should not be insertable. + metadata::database::ColumnInfo { + is_generated: metadata::database::IsGenerated::Stored, + .. + } + | metadata::database::ColumnInfo { + is_identity: metadata::database::IsIdentity::IdentityAlways, + .. + } => (), + _ => { + fields.insert( + name.clone(), + models::ObjectField { + r#type: column_to_type(column), + description: None, + }, + ); + } + } + } + models::ObjectType { + description: None, + fields, + } +} + +/// Given an `InsertMutation`, turn it into a `ProcedureInfo` to be output in the schema. +fn insert_to_procedure( + name: &String, + insert: &insert::InsertMutation, + object_types: &mut BTreeMap, +) -> models::ProcedureInfo { + let mut arguments = BTreeMap::new(); + let object_type = make_object_type(&insert.columns); + let object_name = format!("{name}_object").to_string(); + object_types.insert(object_name.clone(), object_type); + + arguments.insert( + "_object".to_string(), + models::ArgumentInfo { + argument_type: models::Type::Named { name: object_name }, + description: None, + }, + ); + + models::ProcedureInfo { + name: name.to_string(), + description: Some(insert.description.to_string()), + arguments, + result_type: models::Type::Named { + name: insert.collection_name.to_string(), + }, + } +} diff --git a/crates/query-engine/metadata/src/metadata/database.rs b/crates/query-engine/metadata/src/metadata/database.rs index 277c5f7f..1648cd17 100644 --- a/crates/query-engine/metadata/src/metadata/database.rs +++ b/crates/query-engine/metadata/src/metadata/database.rs @@ -122,7 +122,7 @@ pub enum IsIdentity { pub enum IsGenerated { #[default] NotGenerated, - IsGenerated, + Stored, } /// Information about a database column. diff --git a/crates/query-engine/sql/src/sql/ast.rs b/crates/query-engine/sql/src/sql/ast.rs index 2820023a..6e45ecdf 100644 --- a/crates/query-engine/sql/src/sql/ast.rs +++ b/crates/query-engine/sql/src/sql/ast.rs @@ -27,6 +27,7 @@ pub struct CommonTableExpression { pub enum CTExpr { RawSql(Vec), Delete(Delete), + Insert(Insert), } /// Raw SQL written by a user which is opaque to us @@ -51,6 +52,16 @@ pub struct Select { pub limit: Limit, } +/// An INSERT clause +#[derive(Debug, Clone, PartialEq)] +pub struct Insert { + pub schema: SchemaName, + pub table: TableName, + pub columns: Vec, + pub values: Vec, + pub returning: Returning, +} + /// A DELETE clause #[derive(Debug, Clone, PartialEq)] pub struct Delete { diff --git a/crates/query-engine/sql/src/sql/convert.rs b/crates/query-engine/sql/src/sql/convert.rs index 22e891a7..35eb2e45 100644 --- a/crates/query-engine/sql/src/sql/convert.rs +++ b/crates/query-engine/sql/src/sql/convert.rs @@ -53,6 +53,7 @@ impl CTExpr { } } CTExpr::Delete(delete) => delete.to_sql(sql), + CTExpr::Insert(insert) => insert.to_sql(sql), } } } @@ -122,6 +123,38 @@ impl Select { } } +impl Insert { + pub fn to_sql(&self, sql: &mut SQL) { + sql.append_syntax("INSERT INTO "); + + sql.append_identifier(&self.schema.0); + sql.append_syntax("."); + sql.append_identifier(&self.table.0); + sql.append_syntax("("); + for (index, column_name) in self.columns.iter().enumerate() { + sql.append_identifier(&column_name.0.to_string()); + if index < (self.columns.len() - 1) { + sql.append_syntax(", ") + } + } + sql.append_syntax(")"); + + sql.append_syntax(" VALUES "); + sql.append_syntax("("); + for (index, value) in self.values.iter().enumerate() { + value.to_sql(sql); + if index < (self.values.len() - 1) { + sql.append_syntax(", ") + } + } + sql.append_syntax(")"); + + sql.append_syntax(" "); + + self.returning.to_sql(sql); + } +} + impl Delete { pub fn to_sql(&self, sql: &mut SQL) { let Delete { diff --git a/crates/query-engine/sql/src/sql/rewrites/constant_folding.rs b/crates/query-engine/sql/src/sql/rewrites/constant_folding.rs index 4e438e43..7358aad5 100644 --- a/crates/query-engine/sql/src/sql/rewrites/constant_folding.rs +++ b/crates/query-engine/sql/src/sql/rewrites/constant_folding.rs @@ -100,6 +100,7 @@ pub fn normalize_cte(mut cte: CommonTableExpression) -> CommonTableExpression { .collect(), ), CTExpr::Delete(delete) => CTExpr::Delete(normalize_delete(delete)), + CTExpr::Insert(insert) => CTExpr::Insert(normalize_insert(insert)), }; cte } @@ -111,6 +112,12 @@ fn normalize_delete(mut delete: Delete) -> Delete { delete } +/// Normalize everything in an Insert +fn normalize_insert(mut insert: Insert) -> Insert { + insert.values = insert.values.into_iter().map(normalize_expr).collect(); + insert +} + /// Constant expressions folding. Remove redundant expressions. /// This is the main work. The other parts are just trying to apply /// this rewrite to their Expressions. diff --git a/crates/query-engine/translation/src/translation/error.rs b/crates/query-engine/translation/src/translation/error.rs index 8c48a883..62cd313e 100644 --- a/crates/query-engine/translation/src/translation/error.rs +++ b/crates/query-engine/translation/src/translation/error.rs @@ -24,6 +24,9 @@ pub enum Error { UnexpectedVariable, CapabilityNotSupported(UnsupportedCapabilities), UnableToDeserializeNumberAsF64(serde_json::Number), + ColumnIsGenerated(String), + ColumnIsIdentityAlways(String), + MissingColumnInInsert(String, String), NotImplementedYet(String), InternalError(String), } @@ -93,6 +96,23 @@ impl std::fmt::Display for Error { Error::UnableToDeserializeNumberAsF64(num) => { write!(f, "Unable to deserialize the number '{}' as f64.", num) } + Error::ColumnIsGenerated(column) => { + write!( + f, + "Unable to insert into the generated column '{}'.", + column + ) + } + Error::ColumnIsIdentityAlways(column) => { + write!(f, "Unable to insert into the identity column '{}'.", column) + } + Error::MissingColumnInInsert(column, collection) => { + write!( + f, + "Unable to insert into '{}'. Column '{}' is missing.", + collection, column + ) + } Error::CapabilityNotSupported(thing) => { write!(f, "Queries containing {} are not supported.", thing) } diff --git a/crates/query-engine/translation/src/translation/mutation/generate.rs b/crates/query-engine/translation/src/translation/mutation/generate.rs index 6aaf860f..7af39b1e 100644 --- a/crates/query-engine/translation/src/translation/mutation/generate.rs +++ b/crates/query-engine/translation/src/translation/mutation/generate.rs @@ -1,12 +1,15 @@ //! Given introspection data, generate a set of standard mutation procedures use super::delete::{generate_delete_by_unique, DeleteMutation}; +use super::insert; +use super::insert::InsertMutation; use query_engine_metadata::metadata::{database, mutations}; use std::collections::BTreeMap; #[derive(Debug, Clone)] pub enum Mutation { DeleteMutation(DeleteMutation), + InsertMutation(InsertMutation), } /// Given our introspection data, work out all the mutations we can generate @@ -24,6 +27,8 @@ pub fn generate( for (name, delete_mutation) in delete_mutations { mutations.insert(name, Mutation::DeleteMutation(delete_mutation)); } + let (name, insert_mutation) = insert::generate(collection_name, table_info); + mutations.insert(name, Mutation::InsertMutation(insert_mutation)); } } None => {} diff --git a/crates/query-engine/translation/src/translation/mutation/insert.rs b/crates/query-engine/translation/src/translation/mutation/insert.rs new file mode 100644 index 00000000..52cd0bfd --- /dev/null +++ b/crates/query-engine/translation/src/translation/mutation/insert.rs @@ -0,0 +1,145 @@ +//! Auto-generate insert mutations and translate them into sql ast. + +use crate::translation::error::Error; +use crate::translation::query::values::translate_json_value; +use query_engine_metadata::metadata; +use query_engine_metadata::metadata::database; +use query_engine_sql::sql::ast; +use std::collections::BTreeMap; + +/// A representation of an auto-generated insert mutation. +/// +/// This can get us `INSERT INTO () VALUES ()`. +#[derive(Debug, Clone)] +pub struct InsertMutation { + pub collection_name: String, + pub description: String, + pub schema_name: ast::SchemaName, + pub table_name: ast::TableName, + pub columns: BTreeMap, +} + +/// generate an insert mutation. +pub fn generate( + collection_name: &str, + table_info: &database::TableInfo, +) -> (String, InsertMutation) { + let name = format!("v1_insert_{collection_name}"); + + let description = format!("Insert into the {collection_name} table",); + + let insert_mutation = InsertMutation { + collection_name: collection_name.to_string(), + description, + schema_name: ast::SchemaName(table_info.schema_name.clone()), + table_name: ast::TableName(table_info.table_name.clone()), + columns: table_info.columns.clone(), + }; + + (name, insert_mutation) +} + +/// Given the description of an insert mutation (ie, `InsertMutation`), +/// and the arguments, output the SQL AST. +pub fn translate( + // state: &mut crate::translation::helpers::State, + mutation: &InsertMutation, + arguments: BTreeMap, +) -> Result { + let mut columns = vec![]; + let mut values = vec![]; + let object = arguments + .get("_object") + .ok_or(Error::ArgumentNotFound("_object".to_string()))?; + match object { + serde_json::Value::Object(object) => { + for (name, value) in object.iter() { + let column_info = + mutation + .columns + .get(name) + .ok_or(Error::ColumnNotFoundInCollection( + name.clone(), + mutation.collection_name.clone(), + ))?; + + columns.push(ast::ColumnName(column_info.name.clone())); + values.push(translate_json_value(value, &column_info.r#type)?); + } + } + _ => todo!(), + }; + + check_columns(&mutation.columns, &columns, &mutation.collection_name)?; + + let insert = ast::Insert { + schema: mutation.schema_name.clone(), + table: mutation.table_name.clone(), + columns, + values, + returning: ast::Returning::ReturningStar, + }; + Ok(insert) +} + +/// Check that no columns are missing, and that columns cannot be inserted to +/// are not insertred. +fn check_columns( + columns: &BTreeMap, + inserted_columns: &[ast::ColumnName], + insert_name: &str, +) -> Result<(), Error> { + for (name, column) in columns.iter() { + match column { + // nullable, default, and identity by default columns can be inserted into or omitted. + database::ColumnInfo { + nullable: database::Nullable::Nullable, + .. + } + | database::ColumnInfo { + has_default: database::HasDefault::HasDefault, + .. + } + | database::ColumnInfo { + is_identity: database::IsIdentity::IdentityByDefault, + .. + } => Ok(()), + // generated columns must not be inserted into. + database::ColumnInfo { + is_generated: database::IsGenerated::Stored, + .. + } => { + if inserted_columns.contains(&ast::ColumnName(column.name.clone())) { + Err(Error::ColumnIsGenerated(name.clone())) + } else { + Ok(()) + } + } + // identity always columns must not be inserted into. + database::ColumnInfo { + is_identity: database::IsIdentity::IdentityAlways, + .. + } => { + if inserted_columns.contains(&ast::ColumnName(column.name.clone())) { + { + Err(Error::ColumnIsIdentityAlways(name.clone())) + } + } else { + Ok(()) + } + } + // regular columns must be inserted into. + _ => { + if inserted_columns.contains(&ast::ColumnName(column.name.clone())) { + Ok(()) + } else { + Err(Error::MissingColumnInInsert( + name.clone(), + insert_name.to_owned(), + )) + } + } + }?; + } + Ok(()) +} diff --git a/crates/query-engine/translation/src/translation/mutation/mod.rs b/crates/query-engine/translation/src/translation/mutation/mod.rs index 8bd09882..9556b74b 100644 --- a/crates/query-engine/translation/src/translation/mutation/mod.rs +++ b/crates/query-engine/translation/src/translation/mutation/mod.rs @@ -1,4 +1,5 @@ pub mod delete; pub mod generate; +pub mod insert; pub mod translate; pub use translate::translate; diff --git a/crates/query-engine/translation/src/translation/mutation/translate.rs b/crates/query-engine/translation/src/translation/mutation/translate.rs index 007888d2..1713a1f3 100644 --- a/crates/query-engine/translation/src/translation/mutation/translate.rs +++ b/crates/query-engine/translation/src/translation/mutation/translate.rs @@ -36,7 +36,7 @@ pub fn translate( // and failing that, try a generated mutation, { env.lookup_generated_mutation(&name).and_then(|mutation| { - translate_delete_mutation(&env, name, fields, arguments, mutation) + translate_mutation(&env, name, fields, arguments, mutation) }) } } @@ -46,7 +46,7 @@ pub fn translate( /// Translate a built-in delete mutation into an ExecutionPlan (SQL) to be run against the database. /// Most of this is probably reusable for `insert`, `update` etc in future. -fn translate_delete_mutation( +fn translate_mutation( env: &Env, procedure_name: String, fields: Option>, @@ -91,6 +91,13 @@ fn translate_delete_mutation( )?), ) } + mutation::generate::Mutation::InsertMutation(insert) => { + let return_collection = insert.collection_name.clone(); + ( + return_collection, + sql::ast::CTExpr::Insert(mutation::insert::translate(&insert, arguments)?), + ) + } }; let current_table = TableNameAndReference { diff --git a/crates/query-engine/translation/tests/goldenfiles/mutations/v1_insert/request.json b/crates/query-engine/translation/tests/goldenfiles/mutations/v1_insert/request.json new file mode 100644 index 00000000..b644e5f0 --- /dev/null +++ b/crates/query-engine/translation/tests/goldenfiles/mutations/v1_insert/request.json @@ -0,0 +1,25 @@ +{ + "operations": [ + { + "type": "procedure", + "name": "v1_insert_Artist", + "arguments": { + "_object": { + "id": 276, + "name": "Olympians" + } + }, + "fields": { + "artist_id": { + "type": "column", + "column": "id" + }, + "name": { + "type": "column", + "column": "name" + } + } + } + ], + "collection_relationships": {} +} diff --git a/crates/query-engine/translation/tests/goldenfiles/mutations/v1_insert/tables.json b/crates/query-engine/translation/tests/goldenfiles/mutations/v1_insert/tables.json new file mode 100644 index 00000000..743abbac --- /dev/null +++ b/crates/query-engine/translation/tests/goldenfiles/mutations/v1_insert/tables.json @@ -0,0 +1,22 @@ +{ + "tables": { + "Artist": { + "schemaName": "public", + "tableName": "Artist", + "columns": { + "id": { + "name": "ArtistId", + "type": { + "scalarType": "int4" + } + }, + "name": { + "name": "Name", + "type": { + "scalarType": "varchar" + } + } + } + } + } +} diff --git a/crates/query-engine/translation/tests/snapshots/tests__mutations__v1_insert.snap b/crates/query-engine/translation/tests/snapshots/tests__mutations__v1_insert.snap new file mode 100644 index 00000000..196e671f --- /dev/null +++ b/crates/query-engine/translation/tests/snapshots/tests__mutations__v1_insert.snap @@ -0,0 +1,48 @@ +--- +source: crates/query-engine/translation/tests/tests.rs +expression: result +--- +BEGIN +ISOLATION LEVEL READ COMMITTED READ WRITE; + +WITH "%0_generated_mutation" AS ( + INSERT INTO + "public"."Artist"("ArtistId", "Name") + VALUES + (276, cast($1 as varchar)) RETURNING * +) +SELECT + row_to_json("%2_universe") AS "universe" +FROM + ( + SELECT + * + FROM + ( + SELECT + json_build_array( + json_build_object( + '__value', + coalesce(json_agg(row_to_json("%3_returning")), '[]') + ) + ) AS "returning" + FROM + ( + SELECT + "%1_v1_insert_Artist"."ArtistId" AS "artist_id", + "%1_v1_insert_Artist"."Name" AS "name" + FROM + "%0_generated_mutation" AS "%1_v1_insert_Artist" + ) AS "%3_returning" + ) AS "%3_returning" + CROSS JOIN ( + SELECT + COUNT(*) AS "affected_rows" + FROM + "%0_generated_mutation" AS "%1_v1_insert_Artist" + ) AS "%4_aggregates" + ) AS "%2_universe"; + +COMMIT; + +[[(1, String("Olympians"))]] diff --git a/crates/query-engine/translation/tests/tests.rs b/crates/query-engine/translation/tests/tests.rs index 6692b849..6aad4f60 100644 --- a/crates/query-engine/translation/tests/tests.rs +++ b/crates/query-engine/translation/tests/tests.rs @@ -275,6 +275,12 @@ mod mutations { let result = common::test_mutation_translation(None, "simple").unwrap(); insta::assert_snapshot!(result); } + + #[test] + fn v1_insert() { + let result = common::test_mutation_translation(None, "v1_insert").unwrap(); + insta::assert_snapshot!(result); + } } mod transaction { diff --git a/crates/tests/databases-tests/src/citus/snapshots/databases_tests__citus__schema_tests__schema_test__get_schema.snap b/crates/tests/databases-tests/src/citus/snapshots/databases_tests__citus__schema_tests__schema_test__get_schema.snap index 6a4aff29..d78f85a2 100644 --- a/crates/tests/databases-tests/src/citus/snapshots/databases_tests__citus__schema_tests__schema_test__get_schema.snap +++ b/crates/tests/databases-tests/src/citus/snapshots/databases_tests__citus__schema_tests__schema_test__get_schema.snap @@ -2161,6 +2161,536 @@ expression: result } } }, + "v1_insert_Album_object": { + "fields": { + "AlbumId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "ArtistId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Title": { + "type": { + "type": "named", + "name": "varchar" + } + } + } + }, + "v1_insert_Artist_object": { + "fields": { + "ArtistId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_Customer_object": { + "fields": { + "Address": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "City": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Company": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Country": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "CustomerId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Email": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Fax": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "FirstName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "LastName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Phone": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "State": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "SupportRepId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + } + } + }, + "v1_insert_Employee_object": { + "fields": { + "Address": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BirthDate": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "timestamp" + } + } + }, + "City": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Country": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Email": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "EmployeeId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Fax": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "FirstName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "HireDate": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "timestamp" + } + } + }, + "LastName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Phone": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "ReportsTo": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "State": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Title": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_Genre_object": { + "fields": { + "GenreId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_InvoiceLine_object": { + "fields": { + "InvoiceId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "InvoiceLineId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Quantity": { + "type": { + "type": "named", + "name": "int4" + } + }, + "TrackId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "UnitPrice": { + "type": { + "type": "named", + "name": "numeric" + } + } + } + }, + "v1_insert_Invoice_object": { + "fields": { + "BillingAddress": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingCity": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingCountry": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingPostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingState": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "CustomerId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "InvoiceDate": { + "type": { + "type": "named", + "name": "timestamp" + } + }, + "InvoiceId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Total": { + "type": { + "type": "named", + "name": "numeric" + } + } + } + }, + "v1_insert_MediaType_object": { + "fields": { + "MediaTypeId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_PlaylistTrack_object": { + "fields": { + "PlaylistId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "TrackId": { + "type": { + "type": "named", + "name": "int4" + } + } + } + }, + "v1_insert_Playlist_object": { + "fields": { + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PlaylistId": { + "type": { + "type": "named", + "name": "int4" + } + } + } + }, + "v1_insert_Track_object": { + "fields": { + "AlbumId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "Bytes": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "Composer": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "GenreId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "MediaTypeId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Milliseconds": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Name": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "TrackId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "UnitPrice": { + "type": { + "type": "named", + "name": "numeric" + } + } + } + }, "value_types": { "fields": { "bool": { @@ -3070,6 +3600,182 @@ expression: result "type": "named", "name": "Track" } + }, + { + "name": "v1_insert_Album", + "description": "Insert into the Album table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Album_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Album" + } + }, + { + "name": "v1_insert_Artist", + "description": "Insert into the Artist table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Artist_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Artist" + } + }, + { + "name": "v1_insert_Customer", + "description": "Insert into the Customer table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Customer_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Customer" + } + }, + { + "name": "v1_insert_Employee", + "description": "Insert into the Employee table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Employee_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Employee" + } + }, + { + "name": "v1_insert_Genre", + "description": "Insert into the Genre table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Genre_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Genre" + } + }, + { + "name": "v1_insert_Invoice", + "description": "Insert into the Invoice table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Invoice_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Invoice" + } + }, + { + "name": "v1_insert_InvoiceLine", + "description": "Insert into the InvoiceLine table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_InvoiceLine_object" + } + } + }, + "result_type": { + "type": "named", + "name": "InvoiceLine" + } + }, + { + "name": "v1_insert_MediaType", + "description": "Insert into the MediaType table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_MediaType_object" + } + } + }, + "result_type": { + "type": "named", + "name": "MediaType" + } + }, + { + "name": "v1_insert_Playlist", + "description": "Insert into the Playlist table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Playlist_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Playlist" + } + }, + { + "name": "v1_insert_PlaylistTrack", + "description": "Insert into the PlaylistTrack table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_PlaylistTrack_object" + } + } + }, + "result_type": { + "type": "named", + "name": "PlaylistTrack" + } + }, + { + "name": "v1_insert_Track", + "description": "Insert into the Track table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Track_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Track" + } } ] } diff --git a/crates/tests/databases-tests/src/cockroach/snapshots/databases_tests__cockroach__schema_tests__schema_test__get_schema.snap b/crates/tests/databases-tests/src/cockroach/snapshots/databases_tests__cockroach__schema_tests__schema_test__get_schema.snap index a80c4159..33563d33 100644 --- a/crates/tests/databases-tests/src/cockroach/snapshots/databases_tests__cockroach__schema_tests__schema_test__get_schema.snap +++ b/crates/tests/databases-tests/src/cockroach/snapshots/databases_tests__cockroach__schema_tests__schema_test__get_schema.snap @@ -1939,6 +1939,585 @@ expression: result } } }, + "v1_insert_Album_object": { + "fields": { + "AlbumId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "ArtistId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Title": { + "type": { + "type": "named", + "name": "varchar" + } + } + } + }, + "v1_insert_Artist_object": { + "fields": { + "ArtistId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_Customer_object": { + "fields": { + "Address": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "City": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Company": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Country": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "CustomerId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Email": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Fax": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "FirstName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "LastName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Phone": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "State": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "SupportRepId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int8" + } + } + } + } + }, + "v1_insert_Employee_object": { + "fields": { + "Address": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BirthDate": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "timestamp" + } + } + }, + "City": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Country": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Email": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "EmployeeId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Fax": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "FirstName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "HireDate": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "timestamp" + } + } + }, + "LastName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Phone": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "ReportsTo": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int8" + } + } + }, + "State": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Title": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_Genre_object": { + "fields": { + "GenreId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_InvoiceLine_object": { + "fields": { + "InvoiceId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "InvoiceLineId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Quantity": { + "type": { + "type": "named", + "name": "int8" + } + }, + "TrackId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "UnitPrice": { + "type": { + "type": "named", + "name": "numeric" + } + } + } + }, + "v1_insert_Invoice_object": { + "fields": { + "BillingAddress": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingCity": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingCountry": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingPostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingState": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "CustomerId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "InvoiceDate": { + "type": { + "type": "named", + "name": "timestamp" + } + }, + "InvoiceId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Total": { + "type": { + "type": "named", + "name": "numeric" + } + } + } + }, + "v1_insert_MediaType_object": { + "fields": { + "MediaTypeId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_PlaylistTrack_object": { + "fields": { + "PlaylistId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "TrackId": { + "type": { + "type": "named", + "name": "int8" + } + } + } + }, + "v1_insert_Playlist_object": { + "fields": { + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PlaylistId": { + "type": { + "type": "named", + "name": "int8" + } + } + } + }, + "v1_insert_Track_object": { + "fields": { + "AlbumId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int8" + } + } + }, + "Bytes": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int8" + } + } + }, + "Composer": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "GenreId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int8" + } + } + }, + "MediaTypeId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Milliseconds": { + "type": { + "type": "named", + "name": "int8" + } + }, + "Name": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "TrackId": { + "type": { + "type": "named", + "name": "int8" + } + }, + "UnitPrice": { + "type": { + "type": "named", + "name": "numeric" + } + } + } + }, + "v1_insert_pg_extension_spatial_ref_sys_object": { + "fields": { + "auth_name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "auth_srid": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int8" + } + } + }, + "proj4text": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "srid": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int8" + } + } + }, + "srtext": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, "value_types": { "fields": { "bool": { @@ -2822,6 +3401,198 @@ expression: result "type": "named", "name": "Track" } + }, + { + "name": "v1_insert_Album", + "description": "Insert into the Album table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Album_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Album" + } + }, + { + "name": "v1_insert_Artist", + "description": "Insert into the Artist table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Artist_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Artist" + } + }, + { + "name": "v1_insert_Customer", + "description": "Insert into the Customer table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Customer_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Customer" + } + }, + { + "name": "v1_insert_Employee", + "description": "Insert into the Employee table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Employee_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Employee" + } + }, + { + "name": "v1_insert_Genre", + "description": "Insert into the Genre table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Genre_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Genre" + } + }, + { + "name": "v1_insert_Invoice", + "description": "Insert into the Invoice table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Invoice_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Invoice" + } + }, + { + "name": "v1_insert_InvoiceLine", + "description": "Insert into the InvoiceLine table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_InvoiceLine_object" + } + } + }, + "result_type": { + "type": "named", + "name": "InvoiceLine" + } + }, + { + "name": "v1_insert_MediaType", + "description": "Insert into the MediaType table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_MediaType_object" + } + } + }, + "result_type": { + "type": "named", + "name": "MediaType" + } + }, + { + "name": "v1_insert_Playlist", + "description": "Insert into the Playlist table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Playlist_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Playlist" + } + }, + { + "name": "v1_insert_PlaylistTrack", + "description": "Insert into the PlaylistTrack table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_PlaylistTrack_object" + } + } + }, + "result_type": { + "type": "named", + "name": "PlaylistTrack" + } + }, + { + "name": "v1_insert_Track", + "description": "Insert into the Track table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Track_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Track" + } + }, + { + "name": "v1_insert_pg_extension_spatial_ref_sys", + "description": "Insert into the pg_extension_spatial_ref_sys table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_pg_extension_spatial_ref_sys_object" + } + } + }, + "result_type": { + "type": "named", + "name": "pg_extension_spatial_ref_sys" + } } ] } diff --git a/crates/tests/databases-tests/src/postgres/mutation_tests.rs b/crates/tests/databases-tests/src/postgres/mutation_tests.rs index 13153f2d..c2d39682 100644 --- a/crates/tests/databases-tests/src/postgres/mutation_tests.rs +++ b/crates/tests/databases-tests/src/postgres/mutation_tests.rs @@ -68,13 +68,33 @@ mod basic { clean_up_ndc_metadata(ndc_metadata).await.unwrap(); insta::assert_json_snapshot!(result) } + + #[tokio::test] + async fn v1_insert_custom_dog() { + let deployment = create_fresh_deployment( + common::CONNECTION_STRING, + common::CHINOOK_DEPLOYMENT_PATH_V2, + ) + .await + .unwrap(); + + let router = + tests_common::router::create_router_from_deployment(&deployment.deployment_path).await; + + let mutation_result = run_mutation(router.clone(), "v1_insert_custom_dog").await; + + let result = mutation_result; + + clean_up_deployment(deployment).await.unwrap(); + insta::assert_json_snapshot!(result) + } } #[cfg(test)] mod negative { use super::super::common; use tests_common::ndc_metadata::{clean_up_ndc_metadata, create_fresh_ndc_metadata}; - use tests_common::request::{run_mutation403, run_query}; + use tests_common::request::{run_mutation_fail, run_query, StatusCode}; #[tokio::test] /// Check that the second statement fails on duplicate key constraint, @@ -91,7 +111,12 @@ mod negative { tests_common::router::create_router_from_ndc_metadata(&ndc_metadata.ndc_metadata_path) .await; - let mutation_result = run_mutation403(router.clone(), "insert_artist_album_bad").await; + let mutation_result = run_mutation_fail( + router.clone(), + "insert_artist_album_bad", + StatusCode::FORBIDDEN, + ) + .await; // expect no rows returned because first operation was rolled back. let selection_result = run_query(router, "mutations/select_specific_artist").await; @@ -101,4 +126,30 @@ mod negative { clean_up_ndc_metadata(ndc_metadata).await.unwrap(); insta::assert_json_snapshot!(result); } + + #[tokio::test] + /// Check that insert fails due to missing column. + async fn v1_insert_custom_dog_missing_column() { + let deployment = create_fresh_deployment( + common::CONNECTION_STRING, + common::CHINOOK_DEPLOYMENT_PATH_V2, + ) + .await + .unwrap(); + + let router = + tests_common::router::create_router_from_deployment(&deployment.deployment_path).await; + + let mutation_result = run_mutation_fail( + router.clone(), + "v1_insert_custom_dog_missing_column", + StatusCode::BAD_REQUEST, + ) + .await; + + let result = mutation_result; + + clean_up_deployment(deployment).await.unwrap(); + insta::assert_json_snapshot!(result); + } } diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__get_configuration_schema.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__get_configuration_schema.snap index d8b86b3f..6813242d 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__get_configuration_schema.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__get_configuration_schema.snap @@ -1163,7 +1163,7 @@ expression: schema "type": "string", "enum": [ "notGenerated", - "isGenerated" + "stored" ] }, "CompositeTypes": { diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__get_rawconfiguration_v2_schema.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__get_rawconfiguration_v2_schema.snap index e468b396..3925b12a 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__get_rawconfiguration_v2_schema.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__get_rawconfiguration_v2_schema.snap @@ -586,7 +586,7 @@ expression: schema "type": "string", "enum": [ "notGenerated", - "isGenerated" + "stored" ] }, "UniquenessConstraints": { diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v1_initial_configuration_is_unchanged.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v1_initial_configuration_is_unchanged.snap index c4d47083..1138612c 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v1_initial_configuration_is_unchanged.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v1_initial_configuration_is_unchanged.snap @@ -622,6 +622,55 @@ expression: default_configuration }, "description": null }, + "custom_dog": { + "schemaName": "custom", + "tableName": "dog", + "columns": { + "adopter_name": { + "name": "adopter_name", + "type": "text", + "nullable": "nullable", + "description": null + }, + "birthday": { + "name": "birthday", + "type": "date", + "nullable": "nonNullable", + "description": null + }, + "height_cm": { + "name": "height_cm", + "type": "numeric", + "nullable": "nonNullable", + "description": null + }, + "height_in": { + "name": "height_in", + "type": "numeric", + "nullable": "nullable", + "description": null + }, + "id": { + "name": "id", + "type": "int8", + "nullable": "nonNullable", + "description": null + }, + "name": { + "name": "name", + "type": "text", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "dog_pkey": [ + "id" + ] + }, + "foreignRelations": {}, + "description": null + }, "geography_columns": { "schemaName": "public", "tableName": "geography_columns", @@ -902,6 +951,14 @@ expression: default_configuration "returnType": "bool" } }, + "date": { + "max": { + "returnType": "date" + }, + "min": { + "returnType": "date" + } + }, "float8": { "avg": { "returnType": "float8" @@ -962,6 +1019,50 @@ expression: default_configuration "stddev_samp": { "returnType": "numeric" }, + "sum": { + "returnType": "int8" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "int8": { + "avg": { + "returnType": "numeric" + }, + "bit_and": { + "returnType": "int8" + }, + "bit_or": { + "returnType": "int8" + }, + "bit_xor": { + "returnType": "int8" + }, + "max": { + "returnType": "int8" + }, + "min": { + "returnType": "int8" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "numeric" + }, "var_pop": { "returnType": "numeric" }, @@ -1048,6 +1149,32 @@ expression: default_configuration "argumentType": "bool" } }, + "date": { + "_eq": { + "operatorName": "=", + "argumentType": "date" + }, + "_gt": { + "operatorName": ">", + "argumentType": "date" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "date" + }, + "_lt": { + "operatorName": "<", + "argumentType": "date" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "date" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "date" + } + }, "float8": { "_eq": { "operatorName": "=", @@ -1100,6 +1227,32 @@ expression: default_configuration "argumentType": "int4" } }, + "int8": { + "_eq": { + "operatorName": "=", + "argumentType": "int8" + }, + "_gt": { + "operatorName": ">", + "argumentType": "int8" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "int8" + }, + "_lt": { + "operatorName": "<", + "argumentType": "int8" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "int8" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "int8" + } + }, "name": { "_eq": { "operatorName": "=", diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v2_initial_configuration_is_unchanged.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v2_initial_configuration_is_unchanged.snap index 63b42589..053f20db 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v2_initial_configuration_is_unchanged.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__configuration_tests__configuration_tests__postgres_current_only_configure_v2_initial_configuration_is_unchanged.snap @@ -751,6 +751,71 @@ expression: default_configuration }, "description": null }, + "custom_dog": { + "schemaName": "custom", + "tableName": "dog", + "columns": { + "adopter_name": { + "name": "adopter_name", + "type": { + "scalarType": "text" + }, + "nullable": "nullable", + "description": null + }, + "birthday": { + "name": "birthday", + "type": { + "scalarType": "date" + }, + "nullable": "nonNullable", + "hasDefault": "hasDefault", + "description": null + }, + "height_cm": { + "name": "height_cm", + "type": { + "scalarType": "numeric" + }, + "nullable": "nonNullable", + "description": null + }, + "height_in": { + "name": "height_in", + "type": { + "scalarType": "numeric" + }, + "nullable": "nullable", + "hasDefault": "hasDefault", + "isGenerated": "stored", + "description": null + }, + "id": { + "name": "id", + "type": { + "scalarType": "int8" + }, + "nullable": "nonNullable", + "isIdentity": "identityAlways", + "description": null + }, + "name": { + "name": "name", + "type": { + "scalarType": "text" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "dog_pkey": [ + "id" + ] + }, + "foreignRelations": {}, + "description": null + }, "spatial_ref_sys": { "schemaName": "public", "tableName": "spatial_ref_sys", @@ -969,6 +1034,14 @@ expression: default_configuration "returnType": "bool" } }, + "date": { + "max": { + "returnType": "date" + }, + "min": { + "returnType": "date" + } + }, "float8": { "avg": { "returnType": "float8" @@ -1029,6 +1102,50 @@ expression: default_configuration "stddev_samp": { "returnType": "numeric" }, + "sum": { + "returnType": "int8" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "int8": { + "avg": { + "returnType": "numeric" + }, + "bit_and": { + "returnType": "int8" + }, + "bit_or": { + "returnType": "int8" + }, + "bit_xor": { + "returnType": "int8" + }, + "max": { + "returnType": "int8" + }, + "min": { + "returnType": "int8" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "numeric" + }, "var_pop": { "returnType": "numeric" }, @@ -1071,6 +1188,14 @@ expression: default_configuration "returnType": "numeric" } }, + "text": { + "max": { + "returnType": "text" + }, + "min": { + "returnType": "text" + } + }, "timestamp": { "max": { "returnType": "timestamp" @@ -1113,6 +1238,38 @@ expression: default_configuration "isInfix": true } }, + "date": { + "_eq": { + "operatorName": "=", + "argumentType": "date", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "date", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "date", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "date", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "date", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "date", + "isInfix": true + } + }, "float8": { "_eq": { "operatorName": "=", @@ -1177,6 +1334,38 @@ expression: default_configuration "isInfix": true } }, + "int8": { + "_eq": { + "operatorName": "=", + "argumentType": "int8", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "int8", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "int8", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "int8", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "int8", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "int8", + "isInfix": true + } + }, "numeric": { "_eq": { "operatorName": "=", @@ -1209,6 +1398,108 @@ expression: default_configuration "isInfix": true } }, + "text": { + "_eq": { + "operatorName": "=", + "argumentType": "text", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "text", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "text", + "isInfix": true + }, + "_ilike": { + "operatorName": "~~*", + "argumentType": "text", + "isInfix": true + }, + "_iregex": { + "operatorName": "~*", + "argumentType": "text", + "isInfix": true + }, + "_like": { + "operatorName": "~~", + "argumentType": "text", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "text", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "text", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "text", + "isInfix": true + }, + "_nilike": { + "operatorName": "!~~*", + "argumentType": "text", + "isInfix": true + }, + "_niregex": { + "operatorName": "!~*", + "argumentType": "text", + "isInfix": true + }, + "_nlike": { + "operatorName": "!~~", + "argumentType": "text", + "isInfix": true + }, + "_nregex": { + "operatorName": "!~", + "argumentType": "text", + "isInfix": true + }, + "_regex": { + "operatorName": "~", + "argumentType": "text", + "isInfix": true + }, + "st_coveredby": { + "operatorName": "st_coveredby", + "argumentType": "text", + "isInfix": false + }, + "st_covers": { + "operatorName": "st_covers", + "argumentType": "text", + "isInfix": false + }, + "st_intersects": { + "operatorName": "st_intersects", + "argumentType": "text", + "isInfix": false + }, + "st_relatematch": { + "operatorName": "st_relatematch", + "argumentType": "text", + "isInfix": false + }, + "starts_with": { + "operatorName": "starts_with", + "argumentType": "text", + "isInfix": false + }, + "ts_match_tt": { + "operatorName": "ts_match_tt", + "argumentType": "text", + "isInfix": false + } + }, "timestamp": { "_eq": { "operatorName": "=", diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__mutation_tests__basic__v1_insert_custom_dog.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__mutation_tests__basic__v1_insert_custom_dog.snap new file mode 100644 index 00000000..bcf8b78b --- /dev/null +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__mutation_tests__basic__v1_insert_custom_dog.snap @@ -0,0 +1,40 @@ +--- +source: crates/tests/databases-tests/src/postgres/mutation_tests.rs +expression: result +--- +{ + "operation_results": [ + { + "affected_rows": 1, + "returning": [ + { + "__value": [ + { + "id": 1, + "name": "Cremebo", + "birthday": "2024-01-17", + "height_cm": 160, + "height_inch": 62.99212598425197, + "adopter_name": null + } + ] + } + ] + }, + { + "affected_rows": 1, + "returning": [ + { + "__value": [ + { + "name": "Manbo", + "birthday": "2024-01-01", + "height_inch": 135.8267716535433, + "adopter_name": "Joseph" + } + ] + } + ] + } + ] +} diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__mutation_tests__negative__v1_insert_custom_dog_missing_column.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__mutation_tests__negative__v1_insert_custom_dog_missing_column.snap new file mode 100644 index 00000000..42844591 --- /dev/null +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__mutation_tests__negative__v1_insert_custom_dog_missing_column.snap @@ -0,0 +1,10 @@ +--- +source: crates/tests/databases-tests/src/postgres/mutation_tests.rs +expression: result +--- +{ + "message": "Invalid request", + "details": { + "detail": "Unable to insert into 'custom_dog'. Column 'height_cm' is missing." + } +} diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__openapi_tests__openapi__up_to_date_generated_schema.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__openapi_tests__openapi__up_to_date_generated_schema.snap index 8dc9b5d3..1e6fad13 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__openapi_tests__openapi__up_to_date_generated_schema.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__openapi_tests__openapi__up_to_date_generated_schema.snap @@ -1135,7 +1135,7 @@ expression: generated_schema_json "type": "string", "enum": [ "notGenerated", - "isGenerated" + "stored" ] }, "CompositeTypes": { diff --git a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap index 017989e8..8e2cf2f6 100644 --- a/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap +++ b/crates/tests/databases-tests/src/postgres/snapshots/databases_tests__postgres__schema_tests__schema_test__get_schema.snap @@ -2096,6 +2096,52 @@ expression: result } } }, + "custom_dog": { + "fields": { + "adopter_name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "text" + } + } + }, + "birthday": { + "type": { + "type": "named", + "name": "date" + } + }, + "height_cm": { + "type": { + "type": "named", + "name": "numeric" + } + }, + "height_in": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "numeric" + } + } + }, + "id": { + "type": { + "type": "named", + "name": "int8" + } + }, + "name": { + "type": { + "type": "named", + "name": "text" + } + } + } + }, "delete_playlist_track": { "fields": { "PlaylistId": { @@ -2182,50 +2228,746 @@ expression: result "name": "person" } } - } - } - }, - "person": { - "fields": { - "address": { + } + } + }, + "person": { + "fields": { + "address": { + "type": { + "type": "named", + "name": "person_address" + } + }, + "name": { + "type": { + "type": "named", + "name": "person_name" + } + } + } + }, + "person_address": { + "fields": { + "address_line_1": { + "type": { + "type": "named", + "name": "text" + } + }, + "address_line_2": { + "type": { + "type": "named", + "name": "text" + } + } + } + }, + "person_name": { + "fields": { + "first_name": { + "type": { + "type": "named", + "name": "text" + } + }, + "last_name": { + "type": { + "type": "named", + "name": "text" + } + } + } + }, + "spatial_ref_sys": { + "fields": { + "auth_name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "auth_srid": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "proj4text": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "srid": { + "type": { + "type": "named", + "name": "int4" + } + }, + "srtext": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "topology_layer": { + "fields": { + "child_id": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "feature_column": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "feature_type": { + "type": { + "type": "named", + "name": "int4" + } + }, + "layer_id": { + "type": { + "type": "named", + "name": "int4" + } + }, + "level": { + "type": { + "type": "named", + "name": "int4" + } + }, + "schema_name": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "table_name": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "topology_id": { + "type": { + "type": "named", + "name": "int4" + } + } + } + }, + "topology_topology": { + "fields": { + "hasz": { + "type": { + "type": "named", + "name": "bool" + } + }, + "id": { + "type": { + "type": "named", + "name": "int4" + } + }, + "name": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "precision": { + "type": { + "type": "named", + "name": "float8" + } + }, + "srid": { + "type": { + "type": "named", + "name": "int4" + } + } + } + }, + "v1_insert_Album_object": { + "fields": { + "AlbumId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "ArtistId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Title": { + "type": { + "type": "named", + "name": "varchar" + } + } + } + }, + "v1_insert_Artist_object": { + "fields": { + "ArtistId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_Customer_object": { + "fields": { + "Address": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "City": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Company": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Country": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "CustomerId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Email": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Fax": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "FirstName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "LastName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Phone": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "State": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "SupportRepId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + } + } + }, + "v1_insert_Employee_object": { + "fields": { + "Address": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BirthDate": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "timestamp" + } + } + }, + "City": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Country": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Email": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "EmployeeId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Fax": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "FirstName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "HireDate": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "timestamp" + } + } + }, + "LastName": { + "type": { + "type": "named", + "name": "varchar" + } + }, + "Phone": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "ReportsTo": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "State": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "Title": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_Genre_object": { + "fields": { + "GenreId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_InvoiceLine_object": { + "fields": { + "InvoiceId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "InvoiceLineId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Quantity": { + "type": { + "type": "named", + "name": "int4" + } + }, + "TrackId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "UnitPrice": { + "type": { + "type": "named", + "name": "numeric" + } + } + } + }, + "v1_insert_Invoice_object": { + "fields": { + "BillingAddress": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingCity": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingCountry": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingPostalCode": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "BillingState": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "CustomerId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "InvoiceDate": { + "type": { + "type": "named", + "name": "timestamp" + } + }, + "InvoiceId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Total": { + "type": { + "type": "named", + "name": "numeric" + } + } + } + }, + "v1_insert_MediaType_object": { + "fields": { + "MediaTypeId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + } + } + }, + "v1_insert_PlaylistTrack_object": { + "fields": { + "PlaylistId": { + "type": { + "type": "named", + "name": "int4" + } + }, + "TrackId": { + "type": { + "type": "named", + "name": "int4" + } + } + } + }, + "v1_insert_Playlist_object": { + "fields": { + "Name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "PlaylistId": { + "type": { + "type": "named", + "name": "int4" + } + } + } + }, + "v1_insert_Track_object": { + "fields": { + "AlbumId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "Bytes": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "Composer": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "varchar" + } + } + }, + "GenreId": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "int4" + } + } + }, + "MediaTypeId": { "type": { "type": "named", - "name": "person_address" + "name": "int4" } }, - "name": { + "Milliseconds": { "type": { "type": "named", - "name": "person_name" + "name": "int4" } - } - } - }, - "person_address": { - "fields": { - "address_line_1": { + }, + "Name": { "type": { "type": "named", - "name": "text" + "name": "varchar" } }, - "address_line_2": { + "TrackId": { "type": { "type": "named", - "name": "text" + "name": "int4" + } + }, + "UnitPrice": { + "type": { + "type": "named", + "name": "numeric" } } } }, - "person_name": { + "v1_insert_custom_dog_object": { "fields": { - "first_name": { + "adopter_name": { + "type": { + "type": "nullable", + "underlying_type": { + "type": "named", + "name": "text" + } + } + }, + "birthday": { "type": { "type": "named", - "name": "text" + "name": "date" } }, - "last_name": { + "height_cm": { + "type": { + "type": "named", + "name": "numeric" + } + }, + "name": { "type": { "type": "named", "name": "text" @@ -2233,7 +2975,7 @@ expression: result } } }, - "spatial_ref_sys": { + "v1_insert_spatial_ref_sys_object": { "fields": { "auth_name": { "type": { @@ -2279,7 +3021,7 @@ expression: result } } }, - "topology_layer": { + "v1_insert_topology_layer_object": { "fields": { "child_id": { "type": { @@ -2334,7 +3076,7 @@ expression: result } } }, - "topology_topology": { + "v1_insert_topology_topology_object": { "fields": { "hasz": { "type": { @@ -2738,6 +3480,19 @@ expression: result } } }, + { + "name": "custom_dog", + "arguments": {}, + "type": "custom_dog", + "uniqueness_constraints": { + "dog_pkey": { + "unique_columns": [ + "id" + ] + } + }, + "foreign_keys": {} + }, { "name": "spatial_ref_sys", "arguments": {}, @@ -3337,6 +4092,22 @@ expression: result "name": "Track" } }, + { + "name": "v1_delete_custom_dog_by_id", + "description": "Delete any value on the custom_dog table using the id key", + "arguments": { + "id": { + "type": { + "type": "named", + "name": "int8" + } + } + }, + "result_type": { + "type": "named", + "name": "custom_dog" + } + }, { "name": "v1_delete_spatial_ref_sys_by_srid", "description": "Delete any value on the spatial_ref_sys table using the srid key", @@ -3384,6 +4155,246 @@ expression: result "type": "named", "name": "topology_topology" } + }, + { + "name": "v1_insert_Album", + "description": "Insert into the Album table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Album_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Album" + } + }, + { + "name": "v1_insert_Artist", + "description": "Insert into the Artist table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Artist_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Artist" + } + }, + { + "name": "v1_insert_Customer", + "description": "Insert into the Customer table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Customer_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Customer" + } + }, + { + "name": "v1_insert_Employee", + "description": "Insert into the Employee table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Employee_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Employee" + } + }, + { + "name": "v1_insert_Genre", + "description": "Insert into the Genre table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Genre_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Genre" + } + }, + { + "name": "v1_insert_Invoice", + "description": "Insert into the Invoice table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Invoice_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Invoice" + } + }, + { + "name": "v1_insert_InvoiceLine", + "description": "Insert into the InvoiceLine table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_InvoiceLine_object" + } + } + }, + "result_type": { + "type": "named", + "name": "InvoiceLine" + } + }, + { + "name": "v1_insert_MediaType", + "description": "Insert into the MediaType table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_MediaType_object" + } + } + }, + "result_type": { + "type": "named", + "name": "MediaType" + } + }, + { + "name": "v1_insert_Playlist", + "description": "Insert into the Playlist table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Playlist_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Playlist" + } + }, + { + "name": "v1_insert_PlaylistTrack", + "description": "Insert into the PlaylistTrack table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_PlaylistTrack_object" + } + } + }, + "result_type": { + "type": "named", + "name": "PlaylistTrack" + } + }, + { + "name": "v1_insert_Track", + "description": "Insert into the Track table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_Track_object" + } + } + }, + "result_type": { + "type": "named", + "name": "Track" + } + }, + { + "name": "v1_insert_custom_dog", + "description": "Insert into the custom_dog table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_custom_dog_object" + } + } + }, + "result_type": { + "type": "named", + "name": "custom_dog" + } + }, + { + "name": "v1_insert_spatial_ref_sys", + "description": "Insert into the spatial_ref_sys table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_spatial_ref_sys_object" + } + } + }, + "result_type": { + "type": "named", + "name": "spatial_ref_sys" + } + }, + { + "name": "v1_insert_topology_layer", + "description": "Insert into the topology_layer table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_topology_layer_object" + } + } + }, + "result_type": { + "type": "named", + "name": "topology_layer" + } + }, + { + "name": "v1_insert_topology_topology", + "description": "Insert into the topology_topology table", + "arguments": { + "_object": { + "type": { + "type": "named", + "name": "v1_insert_topology_topology_object" + } + } + }, + "result_type": { + "type": "named", + "name": "topology_topology" + } } ] } diff --git a/crates/tests/tests-common/goldenfiles/mutations/v1_insert_custom_dog.json b/crates/tests/tests-common/goldenfiles/mutations/v1_insert_custom_dog.json new file mode 100644 index 00000000..99d1c6fd --- /dev/null +++ b/crates/tests/tests-common/goldenfiles/mutations/v1_insert_custom_dog.json @@ -0,0 +1,71 @@ +{ + "operations": [ + { + "type": "procedure", + "name": "v1_insert_custom_dog", + "arguments": { + "_object": { + "name": "Cremebo", + "height_cm": 160 + } + }, + "fields": { + "id": { + "type": "column", + "column": "id" + }, + "name": { + "type": "column", + "column": "name" + }, + "birthday": { + "type": "column", + "column": "birthday" + }, + "height_cm": { + "type": "column", + "column": "height_cm" + }, + "height_inch": { + "type": "column", + "column": "height_in" + }, + "adopter_name": { + "type": "column", + "column": "adopter_name" + } + } + }, + { + "type": "procedure", + "name": "v1_insert_custom_dog", + "arguments": { + "_object": { + "name": "Manbo", + "height_cm": 345, + "adopter_name": "Joseph", + "birthday": "2024-01-01" + } + }, + "fields": { + "name": { + "type": "column", + "column": "name" + }, + "birthday": { + "type": "column", + "column": "birthday" + }, + "height_inch": { + "type": "column", + "column": "height_in" + }, + "adopter_name": { + "type": "column", + "column": "adopter_name" + } + } + } + ], + "collection_relationships": {} +} diff --git a/crates/tests/tests-common/goldenfiles/mutations/v1_insert_custom_dog_missing_column.json b/crates/tests/tests-common/goldenfiles/mutations/v1_insert_custom_dog_missing_column.json new file mode 100644 index 00000000..7be1a59c --- /dev/null +++ b/crates/tests/tests-common/goldenfiles/mutations/v1_insert_custom_dog_missing_column.json @@ -0,0 +1,40 @@ +{ + "operations": [ + { + "type": "procedure", + "name": "v1_insert_custom_dog", + "arguments": { + "_object": { + "name": "Cremebo" + } + }, + "fields": { + "id": { + "type": "column", + "column": "id" + }, + "name": { + "type": "column", + "column": "name" + }, + "birthday": { + "type": "column", + "column": "birthday" + }, + "height_cm": { + "type": "column", + "column": "height_cm" + }, + "height_inch": { + "type": "column", + "column": "height_in" + }, + "adopter_name": { + "type": "column", + "column": "adopter_name" + } + } + } + ], + "collection_relationships": {} +} diff --git a/crates/tests/tests-common/src/request.rs b/crates/tests/tests-common/src/request.rs index 133ec5e4..2d9bab8f 100644 --- a/crates/tests/tests-common/src/request.rs +++ b/crates/tests/tests-common/src/request.rs @@ -2,7 +2,7 @@ use std::fs; -use axum::http::StatusCode; +pub use axum::http::StatusCode; use serde_derive::Deserialize; /// Run a query against the server, get the result, and compare against the snapshot. @@ -48,17 +48,18 @@ pub async fn run_mutation( .await } -/// Run a mutation that is expected to fail with 403 against the server, +/// Run a mutation that is expected to fail against the server, /// get the result, and compare against the snapshot. -pub async fn run_mutation403( +pub async fn run_mutation_fail( router: axum::Router, testname: &str, + status_code: StatusCode, ) -> ndc_sdk::models::ErrorResponse { run_against_server( router, "mutation", &format!("mutations/{}", testname), - StatusCode::FORBIDDEN, + status_code, ) .await } diff --git a/docker-compose.yaml b/docker-compose.yaml index e61ef34a..465515e8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -26,9 +26,13 @@ services: source: ./static/composite-types-complex.sql target: /docker-entrypoint-initdb.d/02-composite-complex.sql read_only: true + - type: bind + source: ./static/custom-tables.sql + target: /docker-entrypoint-initdb.d/03-custom-tables.sql + read_only: true - type: bind source: ./static/copy-chinook.sql - target: /docker-entrypoint-initdb.d/03-copy-chinook.sql + target: /docker-entrypoint-initdb.d/04-copy-chinook.sql read_only: true healthcheck: test: diff --git a/static/custom-tables.sql b/static/custom-tables.sql new file mode 100644 index 00000000..390631aa --- /dev/null +++ b/static/custom-tables.sql @@ -0,0 +1,13 @@ +-- This file defines custom tables which are used to test the support of less common features. +-- Such as insert into tables with generated columns. + +create schema custom; + +create table custom.dog ( + id bigint primary key generated always as identity, + name text not null, + birthday date not null default '2024-01-17', + adopter_name text null, + height_cm numeric not null, + height_in numeric GENERATED ALWAYS AS (height_cm / 2.54) STORED +); diff --git a/static/ndc-metadata-snapshots/488538ebb81a77e5e5b80004de96c6bf21c36282a5c77a64725835c84eec9968.json b/static/ndc-metadata-snapshots/488538ebb81a77e5e5b80004de96c6bf21c36282a5c77a64725835c84eec9968.json index 0cc803da..5dd744c3 100644 --- a/static/ndc-metadata-snapshots/488538ebb81a77e5e5b80004de96c6bf21c36282a5c77a64725835c84eec9968.json +++ b/static/ndc-metadata-snapshots/488538ebb81a77e5e5b80004de96c6bf21c36282a5c77a64725835c84eec9968.json @@ -596,6 +596,53 @@ }, "description": null }, + "custom_dog": { + "schemaName": "custom", + "tableName": "dog", + "columns": { + "adopter_name": { + "name": "adopter_name", + "type": "text", + "nullable": "nullable", + "description": null + }, + "birthday": { + "name": "birthday", + "type": "date", + "nullable": "nonNullable", + "description": null + }, + "height_cm": { + "name": "height_cm", + "type": "numeric", + "nullable": "nonNullable", + "description": null + }, + "height_in": { + "name": "height_in", + "type": "numeric", + "nullable": "nullable", + "description": null + }, + "id": { + "name": "id", + "type": "int8", + "nullable": "nonNullable", + "description": null + }, + "name": { + "name": "name", + "type": "text", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "dog_pkey": ["id"] + }, + "foreignRelations": {}, + "description": null + }, "geography_columns": { "schemaName": "public", "tableName": "geography_columns", diff --git a/static/ndc-metadata-snapshots/55b5e4a4a84b3e64ad758fd805486f8ee4d853a2bc4d96065b9c8b80a4283689.json b/static/ndc-metadata-snapshots/55b5e4a4a84b3e64ad758fd805486f8ee4d853a2bc4d96065b9c8b80a4283689.json new file mode 100644 index 00000000..d2c01d8d --- /dev/null +++ b/static/ndc-metadata-snapshots/55b5e4a4a84b3e64ad758fd805486f8ee4d853a2bc4d96065b9c8b80a4283689.json @@ -0,0 +1,2897 @@ +{ + "version": "2", + "connectionUri": { + "uri": { + "value": "postgresql://postgres:password@localhost:64002" + } + }, + "isolationLevel": "ReadCommitted", + "metadata": { + "tables": { + "Album": { + "schemaName": "public", + "tableName": "Album", + "columns": { + "AlbumId": { + "name": "AlbumId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": "The identifier of an album" + }, + "ArtistId": { + "name": "ArtistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": "The id of the artist that authored the album" + }, + "Title": { + "name": "Title", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": "The title of an album" + } + }, + "uniquenessConstraints": { + "PK_Album": ["AlbumId"] + }, + "foreignRelations": { + "FK_AlbumArtistId": { + "foreignSchema": "public", + "foreignTable": "Artist", + "columnMapping": { + "ArtistId": "ArtistId" + } + } + }, + "description": "The record of all albums" + }, + "Artist": { + "schemaName": "public", + "tableName": "Artist", + "columns": { + "ArtistId": { + "name": "ArtistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": "The identifier of an artist" + }, + "Name": { + "name": "Name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": "The name of an artist" + } + }, + "uniquenessConstraints": { + "PK_Artist": ["ArtistId"] + }, + "foreignRelations": {}, + "description": "The record of all artists" + }, + "Customer": { + "schemaName": "public", + "tableName": "Customer", + "columns": { + "Address": { + "name": "Address", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "City": { + "name": "City", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "Company": { + "name": "Company", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "Country": { + "name": "Country", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "CustomerId": { + "name": "CustomerId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": "The identifier of customer" + }, + "Email": { + "name": "Email", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": null + }, + "Fax": { + "name": "Fax", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "FirstName": { + "name": "FirstName", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": "The first name of a customer" + }, + "LastName": { + "name": "LastName", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": "The last name of a customer" + }, + "Phone": { + "name": "Phone", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "PostalCode": { + "name": "PostalCode", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "State": { + "name": "State", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "SupportRepId": { + "name": "SupportRepId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Customer": ["CustomerId"] + }, + "foreignRelations": { + "FK_CustomerSupportRepId": { + "foreignSchema": "public", + "foreignTable": "Employee", + "columnMapping": { + "SupportRepId": "EmployeeId" + } + } + }, + "description": "The record of all customers" + }, + "Employee": { + "schemaName": "public", + "tableName": "Employee", + "columns": { + "Address": { + "name": "Address", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "BirthDate": { + "name": "BirthDate", + "type": { + "scalarType": "timestamp" + }, + "nullable": "nullable", + "description": null + }, + "City": { + "name": "City", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "Country": { + "name": "Country", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "Email": { + "name": "Email", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "EmployeeId": { + "name": "EmployeeId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "Fax": { + "name": "Fax", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "FirstName": { + "name": "FirstName", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": null + }, + "HireDate": { + "name": "HireDate", + "type": { + "scalarType": "timestamp" + }, + "nullable": "nullable", + "description": null + }, + "LastName": { + "name": "LastName", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": null + }, + "Phone": { + "name": "Phone", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "PostalCode": { + "name": "PostalCode", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "ReportsTo": { + "name": "ReportsTo", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "State": { + "name": "State", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "Title": { + "name": "Title", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Employee": ["EmployeeId"] + }, + "foreignRelations": { + "FK_EmployeeReportsTo": { + "foreignSchema": "public", + "foreignTable": "Employee", + "columnMapping": { + "ReportsTo": "EmployeeId" + } + } + }, + "description": null + }, + "Genre": { + "schemaName": "public", + "tableName": "Genre", + "columns": { + "GenreId": { + "name": "GenreId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "Name": { + "name": "Name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Genre": ["GenreId"] + }, + "foreignRelations": {}, + "description": null + }, + "Invoice": { + "schemaName": "public", + "tableName": "Invoice", + "columns": { + "BillingAddress": { + "name": "BillingAddress", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "BillingCity": { + "name": "BillingCity", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "BillingCountry": { + "name": "BillingCountry", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "BillingPostalCode": { + "name": "BillingPostalCode", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "BillingState": { + "name": "BillingState", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "CustomerId": { + "name": "CustomerId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "InvoiceDate": { + "name": "InvoiceDate", + "type": { + "scalarType": "timestamp" + }, + "nullable": "nonNullable", + "description": null + }, + "InvoiceId": { + "name": "InvoiceId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "Total": { + "name": "Total", + "type": { + "scalarType": "numeric" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Invoice": ["InvoiceId"] + }, + "foreignRelations": { + "FK_InvoiceCustomerId": { + "foreignSchema": "public", + "foreignTable": "Customer", + "columnMapping": { + "CustomerId": "CustomerId" + } + } + }, + "description": null + }, + "InvoiceLine": { + "schemaName": "public", + "tableName": "InvoiceLine", + "columns": { + "InvoiceId": { + "name": "InvoiceId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "InvoiceLineId": { + "name": "InvoiceLineId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "Quantity": { + "name": "Quantity", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "TrackId": { + "name": "TrackId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "UnitPrice": { + "name": "UnitPrice", + "type": { + "scalarType": "numeric" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_InvoiceLine": ["InvoiceLineId"] + }, + "foreignRelations": { + "FK_InvoiceLineInvoiceId": { + "foreignSchema": "public", + "foreignTable": "Invoice", + "columnMapping": { + "InvoiceId": "InvoiceId" + } + }, + "FK_InvoiceLineTrackId": { + "foreignSchema": "public", + "foreignTable": "Track", + "columnMapping": { + "TrackId": "TrackId" + } + } + }, + "description": null + }, + "MediaType": { + "schemaName": "public", + "tableName": "MediaType", + "columns": { + "MediaTypeId": { + "name": "MediaTypeId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "Name": { + "name": "Name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_MediaType": ["MediaTypeId"] + }, + "foreignRelations": {}, + "description": null + }, + "Playlist": { + "schemaName": "public", + "tableName": "Playlist", + "columns": { + "Name": { + "name": "Name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "PlaylistId": { + "name": "PlaylistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Playlist": ["PlaylistId"] + }, + "foreignRelations": {}, + "description": null + }, + "PlaylistTrack": { + "schemaName": "public", + "tableName": "PlaylistTrack", + "columns": { + "PlaylistId": { + "name": "PlaylistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "TrackId": { + "name": "TrackId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_PlaylistTrack": ["PlaylistId", "TrackId"] + }, + "foreignRelations": { + "FK_PlaylistTrackPlaylistId": { + "foreignSchema": "public", + "foreignTable": "Playlist", + "columnMapping": { + "PlaylistId": "PlaylistId" + } + }, + "FK_PlaylistTrackTrackId": { + "foreignSchema": "public", + "foreignTable": "Track", + "columnMapping": { + "TrackId": "TrackId" + } + } + }, + "description": null + }, + "Track": { + "schemaName": "public", + "tableName": "Track", + "columns": { + "AlbumId": { + "name": "AlbumId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "Bytes": { + "name": "Bytes", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "Composer": { + "name": "Composer", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "GenreId": { + "name": "GenreId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "MediaTypeId": { + "name": "MediaTypeId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "Milliseconds": { + "name": "Milliseconds", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "Name": { + "name": "Name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": null + }, + "TrackId": { + "name": "TrackId", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "UnitPrice": { + "name": "UnitPrice", + "type": { + "scalarType": "numeric" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Track": ["TrackId"] + }, + "foreignRelations": { + "FK_TrackAlbumId": { + "foreignSchema": "public", + "foreignTable": "Album", + "columnMapping": { + "AlbumId": "AlbumId" + } + }, + "FK_TrackGenreId": { + "foreignSchema": "public", + "foreignTable": "Genre", + "columnMapping": { + "GenreId": "GenreId" + } + }, + "FK_TrackMediaTypeId": { + "foreignSchema": "public", + "foreignTable": "MediaType", + "columnMapping": { + "MediaTypeId": "MediaTypeId" + } + } + }, + "description": null + }, + "custom_dog": { + "schemaName": "custom", + "tableName": "dog", + "columns": { + "adopter_name": { + "name": "adopter_name", + "type": { + "scalarType": "text" + }, + "nullable": "nullable", + "description": null + }, + "birthday": { + "name": "birthday", + "type": { + "scalarType": "date" + }, + "nullable": "nonNullable", + "hasDefault": "hasDefault", + "description": null + }, + "height_cm": { + "name": "height_cm", + "type": { + "scalarType": "numeric" + }, + "nullable": "nonNullable", + "description": null + }, + "height_in": { + "name": "height_in", + "type": { + "scalarType": "numeric" + }, + "nullable": "nullable", + "hasDefault": "hasDefault", + "isGenerated": "stored", + "description": null + }, + "id": { + "name": "id", + "type": { + "scalarType": "int8" + }, + "nullable": "nonNullable", + "isIdentity": "identityAlways", + "description": null + }, + "name": { + "name": "name", + "type": { + "scalarType": "text" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "dog_pkey": ["id"] + }, + "foreignRelations": {}, + "description": null + }, + "spatial_ref_sys": { + "schemaName": "public", + "tableName": "spatial_ref_sys", + "columns": { + "auth_name": { + "name": "auth_name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "auth_srid": { + "name": "auth_srid", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "proj4text": { + "name": "proj4text", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + }, + "srid": { + "name": "srid", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "srtext": { + "name": "srtext", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "spatial_ref_sys_pkey": ["srid"] + }, + "foreignRelations": {}, + "description": null + }, + "topology_layer": { + "schemaName": "topology", + "tableName": "layer", + "columns": { + "child_id": { + "name": "child_id", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "feature_column": { + "name": "feature_column", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": null + }, + "feature_type": { + "name": "feature_type", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "layer_id": { + "name": "layer_id", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + }, + "level": { + "name": "level", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "hasDefault": "hasDefault", + "description": null + }, + "schema_name": { + "name": "schema_name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": null + }, + "table_name": { + "name": "table_name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": null + }, + "topology_id": { + "name": "topology_id", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "layer_pkey": ["layer_id", "topology_id"], + "layer_schema_name_table_name_feature_column_key": [ + "feature_column", + "schema_name", + "table_name" + ] + }, + "foreignRelations": { + "layer_topology_id_fkey": { + "foreignSchema": "topology", + "foreignTable": "topology", + "columnMapping": { + "topology_id": "id" + } + } + }, + "description": null + }, + "topology_topology": { + "schemaName": "topology", + "tableName": "topology", + "columns": { + "hasz": { + "name": "hasz", + "type": { + "scalarType": "bool" + }, + "nullable": "nonNullable", + "hasDefault": "hasDefault", + "description": null + }, + "id": { + "name": "id", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "hasDefault": "hasDefault", + "description": null + }, + "name": { + "name": "name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nonNullable", + "description": null + }, + "precision": { + "name": "precision", + "type": { + "scalarType": "float8" + }, + "nullable": "nonNullable", + "description": null + }, + "srid": { + "name": "srid", + "type": { + "scalarType": "int4" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "topology_name_key": ["name"], + "topology_pkey": ["id"] + }, + "foreignRelations": {}, + "description": null + } + }, + "compositeTypes": { + "person": { + "name": "person", + "fields": { + "address": { + "name": "address", + "type": { + "compositeType": "person_address" + }, + "description": null + }, + "name": { + "name": "name", + "type": { + "compositeType": "person_name" + }, + "description": null + } + }, + "description": null + }, + "person_address": { + "name": "person_address", + "fields": { + "address_line_1": { + "name": "address_line_1", + "type": { + "scalarType": "text" + }, + "description": null + }, + "address_line_2": { + "name": "address_line_2", + "type": { + "scalarType": "text" + }, + "description": null + } + }, + "description": null + }, + "person_name": { + "name": "person_name", + "fields": { + "first_name": { + "name": "first_name", + "type": { + "scalarType": "text" + }, + "description": null + }, + "last_name": { + "name": "last_name", + "type": { + "scalarType": "text" + }, + "description": null + } + }, + "description": null + } + }, + "nativeQueries": { + "address_identity_function": { + "sql": "SELECT {{address}} as result", + "columns": { + "result": { + "name": "result", + "type": { + "compositeType": "person_address" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "address": { + "name": "address", + "type": { + "compositeType": "person_address" + }, + "nullable": "nullable", + "description": null + } + }, + "description": "A native query used to test support for composite types" + }, + "album_by_title": { + "sql": "SELECT * FROM public.\"Album\" WHERE \"Title\" LIKE {{title}} AND \"AlbumId\" < {{id}}", + "columns": { + "AlbumId": { + "name": "AlbumId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "ArtistId": { + "name": "ArtistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "Title": { + "name": "Title", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "id": { + "name": "id", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "title": { + "name": "title", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "description": null + }, + "array_reverse": { + "sql": "SELECT array_agg(t.x) as reversed FROM (SELECT x FROM unnest({{array}}) WITH ORDINALITY AS t(x,ix) ORDER BY t.ix DESC) as t(x)", + "columns": { + "reversed": { + "name": "reversed", + "type": { + "arrayType": { + "scalarType": "varchar" + } + }, + "nullable": "nullable", + "description": "The reversed array" + } + }, + "arguments": { + "array": { + "name": "array", + "type": { + "arrayType": { + "scalarType": "varchar" + } + }, + "nullable": "nonNullable", + "description": "The array to reverse. This is necessarily of a monomorphic type." + } + }, + "description": "A native query used to test support for arrays as inputs" + }, + "array_series": { + "sql": "SELECT array_agg(arr.series) AS series FROM (SELECT generate_series({{from}},{{to}}) AS series) AS arr", + "columns": { + "series": { + "name": "series", + "type": { + "arrayType": { + "scalarType": "int4" + } + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "from": { + "name": "from", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "to": { + "name": "to", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + } + }, + "description": "A native query used to test support for arrays" + }, + "artist": { + "sql": "SELECT * FROM public.\"Artist\"", + "columns": { + "ArtistId": { + "name": "ArtistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "Name": { + "name": "Name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": {}, + "description": null + }, + "artist_below_id": { + "sql": "SELECT * FROM public.\"Artist\" WHERE \"ArtistId\" < {{id}}", + "columns": { + "ArtistId": { + "name": "ArtistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "Name": { + "name": "Name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "id": { + "name": "id", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + } + }, + "description": null + }, + "delete_playlist_track": { + "sql": "DELETE FROM public.\"PlaylistTrack\" WHERE \"TrackId\" = {{track_id}} RETURNING *", + "columns": { + "PlaylistId": { + "name": "PlaylistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "TrackId": { + "name": "TrackId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "track_id": { + "name": "track_id", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + } + }, + "description": null, + "isProcedure": true + }, + "insert_album": { + "sql": "INSERT INTO public.\"Album\" VALUES({{id}}, {{title}}, {{artist_id}}) RETURNING *", + "columns": { + "AlbumId": { + "name": "AlbumId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "ArtistId": { + "name": "ArtistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "Title": { + "name": "Title", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "artist_id": { + "name": "artist_id", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "id": { + "name": "id", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "title": { + "name": "title", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "description": null, + "isProcedure": true + }, + "insert_artist": { + "sql": "INSERT INTO public.\"Artist\" VALUES ({{id}}, {{name}}) RETURNING *", + "columns": { + "ArtistId": { + "name": "ArtistId", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "Name": { + "name": "Name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "id": { + "name": "id", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "name": { + "name": "name", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "description": null, + "isProcedure": true + }, + "make_person": { + "sql": "SELECT ROW({{name}}, {{address}})::person as result", + "columns": { + "result": { + "name": "result", + "type": { + "compositeType": "person" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "address": { + "name": "address", + "type": { + "compositeType": "person_address" + }, + "nullable": "nullable", + "description": null + }, + "name": { + "name": "name", + "type": { + "compositeType": "person_name" + }, + "nullable": "nullable", + "description": null + } + }, + "description": "A native query used to test support for composite types" + }, + "value_types": { + "sql": "SELECT {{bool}} as bool, {{int4}} as int4, {{int2}} as int2, {{int8}} as int8, {{float4}} as float4, {{float8}} as \"float8\", {{numeric}} as numeric, {{char}} as char, {{varchar}} as \"varchar\", {{text}} as text, {{date}} as date, {{time}} as time, {{timetz}} as timetz, {{timestamp}} as timestamp, {{timestamptz}} as timestamptz, {{uuid}} as uuid", + "columns": { + "bool": { + "name": "bool", + "type": { + "scalarType": "bool" + }, + "nullable": "nullable", + "description": null + }, + "char": { + "name": "char", + "type": { + "scalarType": "char" + }, + "nullable": "nullable", + "description": null + }, + "date": { + "name": "date", + "type": { + "scalarType": "date" + }, + "nullable": "nullable", + "description": null + }, + "float4": { + "name": "float4", + "type": { + "scalarType": "float4" + }, + "nullable": "nullable", + "description": null + }, + "float8": { + "name": "float8", + "type": { + "scalarType": "float8" + }, + "nullable": "nullable", + "description": null + }, + "int2": { + "name": "int2", + "type": { + "scalarType": "int2" + }, + "nullable": "nullable", + "description": null + }, + "int4": { + "name": "int4", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "int8": { + "name": "int8", + "type": { + "scalarType": "int8" + }, + "nullable": "nullable", + "description": null + }, + "numeric": { + "name": "numeric", + "type": { + "scalarType": "numeric" + }, + "nullable": "nullable", + "description": null + }, + "text": { + "name": "text", + "type": { + "scalarType": "text" + }, + "nullable": "nullable", + "description": null + }, + "time": { + "name": "time", + "type": { + "scalarType": "time" + }, + "nullable": "nullable", + "description": null + }, + "timestamp": { + "name": "timestamp", + "type": { + "scalarType": "timestamp" + }, + "nullable": "nullable", + "description": null + }, + "timestamptz": { + "name": "timestamptz", + "type": { + "scalarType": "timestamptz" + }, + "nullable": "nullable", + "description": null + }, + "timetz": { + "name": "timetz", + "type": { + "scalarType": "timetz" + }, + "nullable": "nullable", + "description": null + }, + "uuid": { + "name": "uuid", + "type": { + "scalarType": "uuid" + }, + "nullable": "nullable", + "description": null + }, + "varchar": { + "name": "varchar", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "bool": { + "name": "bool", + "type": { + "scalarType": "bool" + }, + "nullable": "nullable", + "description": null + }, + "char": { + "name": "char", + "type": { + "scalarType": "char" + }, + "nullable": "nullable", + "description": null + }, + "date": { + "name": "date", + "type": { + "scalarType": "date" + }, + "nullable": "nullable", + "description": null + }, + "float4": { + "name": "float4", + "type": { + "scalarType": "float4" + }, + "nullable": "nullable", + "description": null + }, + "float8": { + "name": "float8", + "type": { + "scalarType": "float8" + }, + "nullable": "nullable", + "description": null + }, + "int2": { + "name": "int2", + "type": { + "scalarType": "int2" + }, + "nullable": "nullable", + "description": null + }, + "int4": { + "name": "int4", + "type": { + "scalarType": "int4" + }, + "nullable": "nullable", + "description": null + }, + "int8": { + "name": "int8", + "type": { + "scalarType": "int8" + }, + "nullable": "nullable", + "description": null + }, + "numeric": { + "name": "numeric", + "type": { + "scalarType": "numeric" + }, + "nullable": "nullable", + "description": null + }, + "text": { + "name": "text", + "type": { + "scalarType": "text" + }, + "nullable": "nullable", + "description": null + }, + "time": { + "name": "time", + "type": { + "scalarType": "time" + }, + "nullable": "nullable", + "description": null + }, + "timestamp": { + "name": "timestamp", + "type": { + "scalarType": "timestamp" + }, + "nullable": "nullable", + "description": null + }, + "timestamptz": { + "name": "timestamptz", + "type": { + "scalarType": "timestamptz" + }, + "nullable": "nullable", + "description": null + }, + "timetz": { + "name": "timetz", + "type": { + "scalarType": "timetz" + }, + "nullable": "nullable", + "description": null + }, + "uuid": { + "name": "uuid", + "type": { + "scalarType": "uuid" + }, + "nullable": "nullable", + "description": null + }, + "varchar": { + "name": "varchar", + "type": { + "scalarType": "varchar" + }, + "nullable": "nullable", + "description": null + } + }, + "description": null + } + }, + "aggregateFunctions": { + "bool": { + "bool_and": { + "returnType": "bool" + }, + "bool_or": { + "returnType": "bool" + }, + "every": { + "returnType": "bool" + } + }, + "date": { + "max": { + "returnType": "date" + }, + "min": { + "returnType": "date" + } + }, + "float4": { + "avg": { + "returnType": "float8" + }, + "max": { + "returnType": "float4" + }, + "min": { + "returnType": "float4" + }, + "stddev": { + "returnType": "float8" + }, + "stddev_pop": { + "returnType": "float8" + }, + "stddev_samp": { + "returnType": "float8" + }, + "sum": { + "returnType": "float4" + }, + "var_pop": { + "returnType": "float8" + }, + "var_samp": { + "returnType": "float8" + }, + "variance": { + "returnType": "float8" + } + }, + "float8": { + "avg": { + "returnType": "float8" + }, + "max": { + "returnType": "float8" + }, + "min": { + "returnType": "float8" + }, + "stddev": { + "returnType": "float8" + }, + "stddev_pop": { + "returnType": "float8" + }, + "stddev_samp": { + "returnType": "float8" + }, + "sum": { + "returnType": "float8" + }, + "var_pop": { + "returnType": "float8" + }, + "var_samp": { + "returnType": "float8" + }, + "variance": { + "returnType": "float8" + } + }, + "int2": { + "avg": { + "returnType": "numeric" + }, + "bit_and": { + "returnType": "int2" + }, + "bit_or": { + "returnType": "int2" + }, + "bit_xor": { + "returnType": "int2" + }, + "max": { + "returnType": "int2" + }, + "min": { + "returnType": "int2" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "int8" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "int4": { + "avg": { + "returnType": "numeric" + }, + "bit_and": { + "returnType": "int4" + }, + "bit_or": { + "returnType": "int4" + }, + "bit_xor": { + "returnType": "int4" + }, + "max": { + "returnType": "int4" + }, + "min": { + "returnType": "int4" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "int8" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "int8": { + "avg": { + "returnType": "numeric" + }, + "bit_and": { + "returnType": "int8" + }, + "bit_or": { + "returnType": "int8" + }, + "bit_xor": { + "returnType": "int8" + }, + "max": { + "returnType": "int8" + }, + "min": { + "returnType": "int8" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "numeric" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "numeric": { + "avg": { + "returnType": "numeric" + }, + "max": { + "returnType": "numeric" + }, + "min": { + "returnType": "numeric" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "numeric" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "text": { + "max": { + "returnType": "text" + }, + "min": { + "returnType": "text" + } + }, + "time": { + "max": { + "returnType": "time" + }, + "min": { + "returnType": "time" + } + }, + "timestamp": { + "max": { + "returnType": "timestamp" + }, + "min": { + "returnType": "timestamp" + } + }, + "timestamptz": { + "max": { + "returnType": "timestamptz" + }, + "min": { + "returnType": "timestamptz" + } + }, + "timetz": { + "max": { + "returnType": "timetz" + }, + "min": { + "returnType": "timetz" + } + } + }, + "comparisonOperators": { + "bool": { + "_eq": { + "operatorName": "=", + "argumentType": "bool", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "bool", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "bool", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "bool", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "bool", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "bool", + "isInfix": true + } + }, + "char": { + "_eq": { + "operatorName": "=", + "argumentType": "char", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "char", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "char", + "isInfix": true + }, + "_ilike": { + "operatorName": "~~*", + "argumentType": "char", + "isInfix": true + }, + "_iregex": { + "operatorName": "~*", + "argumentType": "char", + "isInfix": true + }, + "_like": { + "operatorName": "~~", + "argumentType": "char", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "char", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "char", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "char", + "isInfix": true + }, + "_nilike": { + "operatorName": "!~~*", + "argumentType": "char", + "isInfix": true + }, + "_niregex": { + "operatorName": "!~*", + "argumentType": "char", + "isInfix": true + }, + "_nlike": { + "operatorName": "!~~", + "argumentType": "char", + "isInfix": true + }, + "_nregex": { + "operatorName": "!~", + "argumentType": "char", + "isInfix": true + }, + "_regex": { + "operatorName": "~", + "argumentType": "char", + "isInfix": true + }, + "st_coveredby": { + "operatorName": "st_coveredby", + "argumentType": "char", + "isInfix": false + }, + "st_covers": { + "operatorName": "st_covers", + "argumentType": "char", + "isInfix": false + }, + "st_intersects": { + "operatorName": "st_intersects", + "argumentType": "char", + "isInfix": false + }, + "st_relatematch": { + "operatorName": "st_relatematch", + "argumentType": "char", + "isInfix": false + }, + "starts_with": { + "operatorName": "starts_with", + "argumentType": "char", + "isInfix": false + }, + "ts_match_tt": { + "operatorName": "ts_match_tt", + "argumentType": "char", + "isInfix": false + } + }, + "date": { + "_eq": { + "operatorName": "=", + "argumentType": "date", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "date", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "date", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "date", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "date", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "date", + "isInfix": true + } + }, + "float4": { + "_eq": { + "operatorName": "=", + "argumentType": "float4", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "float4", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "float4", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "float4", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "float4", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "float4", + "isInfix": true + } + }, + "float8": { + "_eq": { + "operatorName": "=", + "argumentType": "float8", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "float8", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "float8", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "float8", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "float8", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "float8", + "isInfix": true + } + }, + "int2": { + "_eq": { + "operatorName": "=", + "argumentType": "int2", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "int2", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "int2", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "int2", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "int2", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "int2", + "isInfix": true + } + }, + "int4": { + "_eq": { + "operatorName": "=", + "argumentType": "int4", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "int4", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "int4", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "int4", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "int4", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "int4", + "isInfix": true + } + }, + "int8": { + "_eq": { + "operatorName": "=", + "argumentType": "int8", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "int8", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "int8", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "int8", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "int8", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "int8", + "isInfix": true + } + }, + "numeric": { + "_eq": { + "operatorName": "=", + "argumentType": "numeric", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "numeric", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "numeric", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "numeric", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "numeric", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "numeric", + "isInfix": true + } + }, + "text": { + "_eq": { + "operatorName": "=", + "argumentType": "text", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "text", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "text", + "isInfix": true + }, + "_ilike": { + "operatorName": "~~*", + "argumentType": "text", + "isInfix": true + }, + "_iregex": { + "operatorName": "~*", + "argumentType": "text", + "isInfix": true + }, + "_like": { + "operatorName": "~~", + "argumentType": "text", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "text", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "text", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "text", + "isInfix": true + }, + "_nilike": { + "operatorName": "!~~*", + "argumentType": "text", + "isInfix": true + }, + "_niregex": { + "operatorName": "!~*", + "argumentType": "text", + "isInfix": true + }, + "_nlike": { + "operatorName": "!~~", + "argumentType": "text", + "isInfix": true + }, + "_nregex": { + "operatorName": "!~", + "argumentType": "text", + "isInfix": true + }, + "_regex": { + "operatorName": "~", + "argumentType": "text", + "isInfix": true + }, + "st_coveredby": { + "operatorName": "st_coveredby", + "argumentType": "text", + "isInfix": false + }, + "st_covers": { + "operatorName": "st_covers", + "argumentType": "text", + "isInfix": false + }, + "st_intersects": { + "operatorName": "st_intersects", + "argumentType": "text", + "isInfix": false + }, + "st_relatematch": { + "operatorName": "st_relatematch", + "argumentType": "text", + "isInfix": false + }, + "starts_with": { + "operatorName": "starts_with", + "argumentType": "text", + "isInfix": false + }, + "ts_match_tt": { + "operatorName": "ts_match_tt", + "argumentType": "text", + "isInfix": false + } + }, + "time": { + "_eq": { + "operatorName": "=", + "argumentType": "time", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "time", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "time", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "time", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "time", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "time", + "isInfix": true + } + }, + "timestamp": { + "_eq": { + "operatorName": "=", + "argumentType": "timestamp", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "timestamp", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "timestamp", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "timestamp", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "timestamp", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "timestamp", + "isInfix": true + } + }, + "timestamptz": { + "_eq": { + "operatorName": "=", + "argumentType": "timestamptz", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "timestamptz", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "timestamptz", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "timestamptz", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "timestamptz", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "timestamptz", + "isInfix": true + } + }, + "timetz": { + "_eq": { + "operatorName": "=", + "argumentType": "timetz", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "timetz", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "timetz", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "timetz", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "timetz", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "timetz", + "isInfix": true + } + }, + "uuid": { + "_eq": { + "operatorName": "=", + "argumentType": "uuid", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "uuid", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "uuid", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "uuid", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "uuid", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "uuid", + "isInfix": true + } + }, + "varchar": { + "_eq": { + "operatorName": "=", + "argumentType": "varchar", + "isInfix": true + }, + "_gt": { + "operatorName": ">", + "argumentType": "varchar", + "isInfix": true + }, + "_gte": { + "operatorName": ">=", + "argumentType": "varchar", + "isInfix": true + }, + "_ilike": { + "operatorName": "~~*", + "argumentType": "varchar", + "isInfix": true + }, + "_iregex": { + "operatorName": "~*", + "argumentType": "varchar", + "isInfix": true + }, + "_like": { + "operatorName": "~~", + "argumentType": "varchar", + "isInfix": true + }, + "_lt": { + "operatorName": "<", + "argumentType": "varchar", + "isInfix": true + }, + "_lte": { + "operatorName": "<=", + "argumentType": "varchar", + "isInfix": true + }, + "_neq": { + "operatorName": "<>", + "argumentType": "varchar", + "isInfix": true + }, + "_nilike": { + "operatorName": "!~~*", + "argumentType": "varchar", + "isInfix": true + }, + "_niregex": { + "operatorName": "!~*", + "argumentType": "varchar", + "isInfix": true + }, + "_nlike": { + "operatorName": "!~~", + "argumentType": "varchar", + "isInfix": true + }, + "_nregex": { + "operatorName": "!~", + "argumentType": "varchar", + "isInfix": true + }, + "_regex": { + "operatorName": "~", + "argumentType": "varchar", + "isInfix": true + }, + "st_coveredby": { + "operatorName": "st_coveredby", + "argumentType": "varchar", + "isInfix": false + }, + "st_covers": { + "operatorName": "st_covers", + "argumentType": "varchar", + "isInfix": false + }, + "st_intersects": { + "operatorName": "st_intersects", + "argumentType": "varchar", + "isInfix": false + }, + "st_relatematch": { + "operatorName": "st_relatematch", + "argumentType": "varchar", + "isInfix": false + }, + "starts_with": { + "operatorName": "starts_with", + "argumentType": "varchar", + "isInfix": false + }, + "ts_match_tt": { + "operatorName": "ts_match_tt", + "argumentType": "varchar", + "isInfix": false + } + } + } + }, + "configureOptions": { + "excludedSchemas": [ + "information_schema", + "pg_catalog", + "tiger", + "crdb_internal", + "columnar", + "columnar_internal" + ], + "unqualifiedSchemas": ["public"], + "comparisonOperatorMapping": [ + { + "operatorName": "=", + "exposedName": "_eq" + }, + { + "operatorName": "<=", + "exposedName": "_lte" + }, + { + "operatorName": ">", + "exposedName": "_gt" + }, + { + "operatorName": ">=", + "exposedName": "_gte" + }, + { + "operatorName": "<", + "exposedName": "_lt" + }, + { + "operatorName": "!=", + "exposedName": "_neq" + }, + { + "operatorName": "LIKE", + "exposedName": "_like" + }, + { + "operatorName": "NOT LIKE", + "exposedName": "_nlike" + }, + { + "operatorName": "ILIKE", + "exposedName": "_ilike" + }, + { + "operatorName": "NOT ILIKE", + "exposedName": "_nilike" + }, + { + "operatorName": "SIMILAR TO", + "exposedName": "_similar" + }, + { + "operatorName": "NOT SIMILAR TO", + "exposedName": "_nsimilar" + }, + { + "operatorName": "<>", + "exposedName": "_neq" + }, + { + "operatorName": "~~", + "exposedName": "_like" + }, + { + "operatorName": "!~~", + "exposedName": "_nlike" + }, + { + "operatorName": "~~*", + "exposedName": "_ilike" + }, + { + "operatorName": "!~~*", + "exposedName": "_nilike" + }, + { + "operatorName": "~", + "exposedName": "_regex" + }, + { + "operatorName": "!~", + "exposedName": "_nregex" + }, + { + "operatorName": "~*", + "exposedName": "_iregex" + }, + { + "operatorName": "!~*", + "exposedName": "_niregex" + } + ], + "mutationsVersion": "v1", + "introspectPrefixFunctionComparisonOperators": [ + "box_above", + "box_below", + "box_contain", + "box_contain_pt", + "box_contained", + "box_left", + "box_overabove", + "box_overbelow", + "box_overlap", + "box_overleft", + "box_overright", + "box_right", + "box_same", + "circle_above", + "circle_below", + "circle_contain", + "circle_contain_pt", + "circle_contained", + "circle_left", + "circle_overabove", + "circle_overbelow", + "circle_overlap", + "circle_overleft", + "circle_overright", + "circle_right", + "circle_same", + "contains_2d", + "equals", + "geography_overlaps", + "geometry_above", + "geometry_below", + "geometry_contained_3d", + "geometry_contains", + "geometry_contains_3d", + "geometry_contains_nd", + "geometry_left", + "geometry_overabove", + "geometry_overbelow", + "geometry_overlaps", + "geometry_overlaps_3d", + "geometry_overlaps_nd", + "geometry_overleft", + "geometry_overright", + "geometry_right", + "geometry_same", + "geometry_same_3d", + "geometry_same_nd", + "geometry_within", + "geometry_within_nd", + "inet_same_family", + "inter_lb", + "inter_sb", + "inter_sl", + "is_contained_2d", + "ishorizontal", + "isparallel", + "isperp", + "isvertical", + "jsonb_contained", + "jsonb_contains", + "jsonb_exists", + "jsonb_path_exists_opr", + "jsonb_path_match_opr", + "line_intersect", + "line_parallel", + "line_perp", + "lseg_intersect", + "lseg_parallel", + "lseg_perp", + "network_overlap", + "network_sub", + "network_sup", + "on_pb", + "on_pl", + "on_ppath", + "on_ps", + "on_sb", + "on_sl", + "overlaps_2d", + "path_contain_pt", + "path_inter", + "point_above", + "point_below", + "point_horiz", + "point_left", + "point_right", + "point_vert", + "poly_above", + "poly_below", + "poly_contain", + "poly_contain_pt", + "poly_contained", + "poly_left", + "poly_overabove", + "poly_overbelow", + "poly_overlap", + "poly_overleft", + "poly_overright", + "poly_right", + "poly_same", + "pt_contained_poly", + "st_3dintersects", + "st_contains", + "st_containsproperly", + "st_coveredby", + "st_covers", + "st_crosses", + "st_disjoint", + "st_equals", + "st_intersects", + "st_isvalid", + "st_orderingequals", + "st_overlaps", + "st_relatematch", + "st_touches", + "st_within", + "starts_with", + "ts_match_qv", + "ts_match_tq", + "ts_match_tt", + "ts_match_vq", + "tsq_mcontained", + "tsq_mcontains", + "xmlexists", + "xmlvalidate", + "xpath_exists" + ] + } +} diff --git a/static/ndc-metadata-snapshots/d37aa40e768d774850e1fc638eab23559ef47a82f0f7f8acc44fe84fc4c9b0e2.json b/static/ndc-metadata-snapshots/d37aa40e768d774850e1fc638eab23559ef47a82f0f7f8acc44fe84fc4c9b0e2.json new file mode 100644 index 00000000..5dd744c3 --- /dev/null +++ b/static/ndc-metadata-snapshots/d37aa40e768d774850e1fc638eab23559ef47a82f0f7f8acc44fe84fc4c9b0e2.json @@ -0,0 +1,2244 @@ +{ + "version": 1, + "connectionUri": { + "uri": { + "value": "postgresql://postgres:password@localhost:64002" + } + }, + "metadata": { + "tables": { + "Album": { + "schemaName": "public", + "tableName": "Album", + "columns": { + "AlbumId": { + "name": "AlbumId", + "type": "int4", + "nullable": "nonNullable", + "description": "The identifier of an album" + }, + "ArtistId": { + "name": "ArtistId", + "type": "int4", + "nullable": "nonNullable", + "description": "The id of the artist that authored the album" + }, + "Title": { + "name": "Title", + "type": "varchar", + "nullable": "nonNullable", + "description": "The title of an album" + } + }, + "uniquenessConstraints": { + "PK_Album": ["AlbumId"] + }, + "foreignRelations": { + "FK_AlbumArtistId": { + "foreignSchema": "public", + "foreignTable": "Artist", + "columnMapping": { + "ArtistId": "ArtistId" + } + } + }, + "description": "The record of all albums" + }, + "Artist": { + "schemaName": "public", + "tableName": "Artist", + "columns": { + "ArtistId": { + "name": "ArtistId", + "type": "int4", + "nullable": "nonNullable", + "description": "The identifier of an artist" + }, + "Name": { + "name": "Name", + "type": "varchar", + "nullable": "nullable", + "description": "The name of an artist" + } + }, + "uniquenessConstraints": { + "PK_Artist": ["ArtistId"] + }, + "foreignRelations": {}, + "description": "The record of all artists" + }, + "Customer": { + "schemaName": "public", + "tableName": "Customer", + "columns": { + "Address": { + "name": "Address", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "City": { + "name": "City", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "Company": { + "name": "Company", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "Country": { + "name": "Country", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "CustomerId": { + "name": "CustomerId", + "type": "int4", + "nullable": "nonNullable", + "description": "The identifier of customer" + }, + "Email": { + "name": "Email", + "type": "varchar", + "nullable": "nonNullable", + "description": null + }, + "Fax": { + "name": "Fax", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "FirstName": { + "name": "FirstName", + "type": "varchar", + "nullable": "nonNullable", + "description": "The first name of a customer" + }, + "LastName": { + "name": "LastName", + "type": "varchar", + "nullable": "nonNullable", + "description": "The last name of a customer" + }, + "Phone": { + "name": "Phone", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "PostalCode": { + "name": "PostalCode", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "State": { + "name": "State", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "SupportRepId": { + "name": "SupportRepId", + "type": "int4", + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Customer": ["CustomerId"] + }, + "foreignRelations": { + "FK_CustomerSupportRepId": { + "foreignSchema": "public", + "foreignTable": "Employee", + "columnMapping": { + "SupportRepId": "EmployeeId" + } + } + }, + "description": "The record of all customers" + }, + "Employee": { + "schemaName": "public", + "tableName": "Employee", + "columns": { + "Address": { + "name": "Address", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "BirthDate": { + "name": "BirthDate", + "type": "timestamp", + "nullable": "nullable", + "description": null + }, + "City": { + "name": "City", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "Country": { + "name": "Country", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "Email": { + "name": "Email", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "EmployeeId": { + "name": "EmployeeId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "Fax": { + "name": "Fax", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "FirstName": { + "name": "FirstName", + "type": "varchar", + "nullable": "nonNullable", + "description": null + }, + "HireDate": { + "name": "HireDate", + "type": "timestamp", + "nullable": "nullable", + "description": null + }, + "LastName": { + "name": "LastName", + "type": "varchar", + "nullable": "nonNullable", + "description": null + }, + "Phone": { + "name": "Phone", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "PostalCode": { + "name": "PostalCode", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "ReportsTo": { + "name": "ReportsTo", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "State": { + "name": "State", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "Title": { + "name": "Title", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Employee": ["EmployeeId"] + }, + "foreignRelations": { + "FK_EmployeeReportsTo": { + "foreignSchema": "public", + "foreignTable": "Employee", + "columnMapping": { + "ReportsTo": "EmployeeId" + } + } + }, + "description": null + }, + "Genre": { + "schemaName": "public", + "tableName": "Genre", + "columns": { + "GenreId": { + "name": "GenreId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "Name": { + "name": "Name", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Genre": ["GenreId"] + }, + "foreignRelations": {}, + "description": null + }, + "Invoice": { + "schemaName": "public", + "tableName": "Invoice", + "columns": { + "BillingAddress": { + "name": "BillingAddress", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "BillingCity": { + "name": "BillingCity", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "BillingCountry": { + "name": "BillingCountry", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "BillingPostalCode": { + "name": "BillingPostalCode", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "BillingState": { + "name": "BillingState", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "CustomerId": { + "name": "CustomerId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "InvoiceDate": { + "name": "InvoiceDate", + "type": "timestamp", + "nullable": "nonNullable", + "description": null + }, + "InvoiceId": { + "name": "InvoiceId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "Total": { + "name": "Total", + "type": "numeric", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Invoice": ["InvoiceId"] + }, + "foreignRelations": { + "FK_InvoiceCustomerId": { + "foreignSchema": "public", + "foreignTable": "Customer", + "columnMapping": { + "CustomerId": "CustomerId" + } + } + }, + "description": null + }, + "InvoiceLine": { + "schemaName": "public", + "tableName": "InvoiceLine", + "columns": { + "InvoiceId": { + "name": "InvoiceId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "InvoiceLineId": { + "name": "InvoiceLineId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "Quantity": { + "name": "Quantity", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "TrackId": { + "name": "TrackId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "UnitPrice": { + "name": "UnitPrice", + "type": "numeric", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_InvoiceLine": ["InvoiceLineId"] + }, + "foreignRelations": { + "FK_InvoiceLineInvoiceId": { + "foreignSchema": "public", + "foreignTable": "Invoice", + "columnMapping": { + "InvoiceId": "InvoiceId" + } + }, + "FK_InvoiceLineTrackId": { + "foreignSchema": "public", + "foreignTable": "Track", + "columnMapping": { + "TrackId": "TrackId" + } + } + }, + "description": null + }, + "MediaType": { + "schemaName": "public", + "tableName": "MediaType", + "columns": { + "MediaTypeId": { + "name": "MediaTypeId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "Name": { + "name": "Name", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_MediaType": ["MediaTypeId"] + }, + "foreignRelations": {}, + "description": null + }, + "Playlist": { + "schemaName": "public", + "tableName": "Playlist", + "columns": { + "Name": { + "name": "Name", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "PlaylistId": { + "name": "PlaylistId", + "type": "int4", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Playlist": ["PlaylistId"] + }, + "foreignRelations": {}, + "description": null + }, + "PlaylistTrack": { + "schemaName": "public", + "tableName": "PlaylistTrack", + "columns": { + "PlaylistId": { + "name": "PlaylistId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "TrackId": { + "name": "TrackId", + "type": "int4", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_PlaylistTrack": ["PlaylistId", "TrackId"] + }, + "foreignRelations": { + "FK_PlaylistTrackPlaylistId": { + "foreignSchema": "public", + "foreignTable": "Playlist", + "columnMapping": { + "PlaylistId": "PlaylistId" + } + }, + "FK_PlaylistTrackTrackId": { + "foreignSchema": "public", + "foreignTable": "Track", + "columnMapping": { + "TrackId": "TrackId" + } + } + }, + "description": null + }, + "Track": { + "schemaName": "public", + "tableName": "Track", + "columns": { + "AlbumId": { + "name": "AlbumId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "Bytes": { + "name": "Bytes", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "Composer": { + "name": "Composer", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "GenreId": { + "name": "GenreId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "MediaTypeId": { + "name": "MediaTypeId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "Milliseconds": { + "name": "Milliseconds", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "Name": { + "name": "Name", + "type": "varchar", + "nullable": "nonNullable", + "description": null + }, + "TrackId": { + "name": "TrackId", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "UnitPrice": { + "name": "UnitPrice", + "type": "numeric", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "PK_Track": ["TrackId"] + }, + "foreignRelations": { + "FK_TrackAlbumId": { + "foreignSchema": "public", + "foreignTable": "Album", + "columnMapping": { + "AlbumId": "AlbumId" + } + }, + "FK_TrackGenreId": { + "foreignSchema": "public", + "foreignTable": "Genre", + "columnMapping": { + "GenreId": "GenreId" + } + }, + "FK_TrackMediaTypeId": { + "foreignSchema": "public", + "foreignTable": "MediaType", + "columnMapping": { + "MediaTypeId": "MediaTypeId" + } + } + }, + "description": null + }, + "custom_dog": { + "schemaName": "custom", + "tableName": "dog", + "columns": { + "adopter_name": { + "name": "adopter_name", + "type": "text", + "nullable": "nullable", + "description": null + }, + "birthday": { + "name": "birthday", + "type": "date", + "nullable": "nonNullable", + "description": null + }, + "height_cm": { + "name": "height_cm", + "type": "numeric", + "nullable": "nonNullable", + "description": null + }, + "height_in": { + "name": "height_in", + "type": "numeric", + "nullable": "nullable", + "description": null + }, + "id": { + "name": "id", + "type": "int8", + "nullable": "nonNullable", + "description": null + }, + "name": { + "name": "name", + "type": "text", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "dog_pkey": ["id"] + }, + "foreignRelations": {}, + "description": null + }, + "geography_columns": { + "schemaName": "public", + "tableName": "geography_columns", + "columns": { + "coord_dimension": { + "name": "coord_dimension", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "f_geography_column": { + "name": "f_geography_column", + "type": "name", + "nullable": "nullable", + "description": null + }, + "f_table_catalog": { + "name": "f_table_catalog", + "type": "name", + "nullable": "nullable", + "description": null + }, + "f_table_name": { + "name": "f_table_name", + "type": "name", + "nullable": "nullable", + "description": null + }, + "f_table_schema": { + "name": "f_table_schema", + "type": "name", + "nullable": "nullable", + "description": null + }, + "srid": { + "name": "srid", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "type": { + "name": "type", + "type": "text", + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": {}, + "foreignRelations": {}, + "description": null + }, + "geometry_columns": { + "schemaName": "public", + "tableName": "geometry_columns", + "columns": { + "coord_dimension": { + "name": "coord_dimension", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "f_geometry_column": { + "name": "f_geometry_column", + "type": "name", + "nullable": "nullable", + "description": null + }, + "f_table_catalog": { + "name": "f_table_catalog", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "f_table_name": { + "name": "f_table_name", + "type": "name", + "nullable": "nullable", + "description": null + }, + "f_table_schema": { + "name": "f_table_schema", + "type": "name", + "nullable": "nullable", + "description": null + }, + "srid": { + "name": "srid", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "type": { + "name": "type", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": {}, + "foreignRelations": {}, + "description": null + }, + "spatial_ref_sys": { + "schemaName": "public", + "tableName": "spatial_ref_sys", + "columns": { + "auth_name": { + "name": "auth_name", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "auth_srid": { + "name": "auth_srid", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "proj4text": { + "name": "proj4text", + "type": "varchar", + "nullable": "nullable", + "description": null + }, + "srid": { + "name": "srid", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "srtext": { + "name": "srtext", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "uniquenessConstraints": { + "spatial_ref_sys_pkey": ["srid"] + }, + "foreignRelations": {}, + "description": null + }, + "topology_layer": { + "schemaName": "topology", + "tableName": "layer", + "columns": { + "child_id": { + "name": "child_id", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "feature_column": { + "name": "feature_column", + "type": "varchar", + "nullable": "nonNullable", + "description": null + }, + "feature_type": { + "name": "feature_type", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "layer_id": { + "name": "layer_id", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "level": { + "name": "level", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "schema_name": { + "name": "schema_name", + "type": "varchar", + "nullable": "nonNullable", + "description": null + }, + "table_name": { + "name": "table_name", + "type": "varchar", + "nullable": "nonNullable", + "description": null + }, + "topology_id": { + "name": "topology_id", + "type": "int4", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "layer_pkey": ["layer_id", "topology_id"], + "layer_schema_name_table_name_feature_column_key": [ + "feature_column", + "schema_name", + "table_name" + ] + }, + "foreignRelations": { + "layer_topology_id_fkey": { + "foreignSchema": "topology", + "foreignTable": "topology", + "columnMapping": { + "topology_id": "id" + } + } + }, + "description": null + }, + "topology_topology": { + "schemaName": "topology", + "tableName": "topology", + "columns": { + "hasz": { + "name": "hasz", + "type": "bool", + "nullable": "nonNullable", + "description": null + }, + "id": { + "name": "id", + "type": "int4", + "nullable": "nonNullable", + "description": null + }, + "name": { + "name": "name", + "type": "varchar", + "nullable": "nonNullable", + "description": null + }, + "precision": { + "name": "precision", + "type": "float8", + "nullable": "nonNullable", + "description": null + }, + "srid": { + "name": "srid", + "type": "int4", + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "topology_name_key": ["name"], + "topology_pkey": ["id"] + }, + "foreignRelations": {}, + "description": null + } + }, + "nativeQueries": { + "album_by_title": { + "sql": "SELECT * FROM public.\"Album\" WHERE \"Title\" LIKE {{title}} AND \"AlbumId\" < {{id}}", + "columns": { + "AlbumId": { + "name": "AlbumId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "ArtistId": { + "name": "ArtistId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "Title": { + "name": "Title", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "id": { + "name": "id", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "title": { + "name": "title", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "description": null + }, + "artist": { + "sql": "SELECT * FROM public.\"Artist\"", + "columns": { + "ArtistId": { + "name": "ArtistId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "Name": { + "name": "Name", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "arguments": {}, + "description": null + }, + "artist_below_id": { + "sql": "SELECT * FROM public.\"Artist\" WHERE \"ArtistId\" < {{id}}", + "columns": { + "ArtistId": { + "name": "ArtistId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "Name": { + "name": "Name", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "id": { + "name": "id", + "type": "int4", + "nullable": "nullable", + "description": null + } + }, + "description": null + }, + "delete_playlist_track": { + "sql": "DELETE FROM public.\"PlaylistTrack\" WHERE \"TrackId\" = {{track_id}} RETURNING *", + "columns": { + "PlaylistId": { + "name": "PlaylistId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "TrackId": { + "name": "TrackId", + "type": "int4", + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "track_id": { + "name": "track_id", + "type": "int4", + "nullable": "nullable", + "description": null + } + }, + "description": null, + "isProcedure": true + }, + "insert_album": { + "sql": "INSERT INTO public.\"Album\" VALUES({{id}}, {{title}}, {{artist_id}}) RETURNING *", + "columns": { + "AlbumId": { + "name": "AlbumId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "ArtistId": { + "name": "ArtistId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "Title": { + "name": "Title", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "artist_id": { + "name": "artist_id", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "id": { + "name": "id", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "title": { + "name": "title", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "description": null, + "isProcedure": true + }, + "insert_artist": { + "sql": "INSERT INTO public.\"Artist\" VALUES ({{id}}, {{name}}) RETURNING *", + "columns": { + "ArtistId": { + "name": "ArtistId", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "Name": { + "name": "Name", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "id": { + "name": "id", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "name": { + "name": "name", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "description": null, + "isProcedure": true + }, + "value_types": { + "sql": "SELECT {{bool}} as bool, {{int4}} as int4, {{int2}} as int2, {{int8}} as int8, {{float4}} as float4, {{float8}} as \"float8\", {{numeric}} as numeric, {{char}} as char, {{varchar}} as \"varchar\", {{text}} as text, {{date}} as date, {{time}} as time, {{timetz}} as timetz, {{timestamp}} as timestamp, {{timestamptz}} as timestamptz, {{uuid}} as uuid", + "columns": { + "bool": { + "name": "bool", + "type": "bool", + "nullable": "nullable", + "description": null + }, + "char": { + "name": "char", + "type": "char", + "nullable": "nullable", + "description": null + }, + "date": { + "name": "date", + "type": "date", + "nullable": "nullable", + "description": null + }, + "float4": { + "name": "float4", + "type": "float4", + "nullable": "nullable", + "description": null + }, + "float8": { + "name": "float8", + "type": "float8", + "nullable": "nullable", + "description": null + }, + "int2": { + "name": "int2", + "type": "int2", + "nullable": "nullable", + "description": null + }, + "int4": { + "name": "int4", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "int8": { + "name": "int8", + "type": "int8", + "nullable": "nullable", + "description": null + }, + "numeric": { + "name": "numeric", + "type": "numeric", + "nullable": "nullable", + "description": null + }, + "text": { + "name": "text", + "type": "text", + "nullable": "nullable", + "description": null + }, + "time": { + "name": "time", + "type": "time", + "nullable": "nullable", + "description": null + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "nullable": "nullable", + "description": null + }, + "timestamptz": { + "name": "timestamptz", + "type": "timestamptz", + "nullable": "nullable", + "description": null + }, + "timetz": { + "name": "timetz", + "type": "timetz", + "nullable": "nullable", + "description": null + }, + "uuid": { + "name": "uuid", + "type": "uuid", + "nullable": "nullable", + "description": null + }, + "varchar": { + "name": "varchar", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "arguments": { + "bool": { + "name": "bool", + "type": "bool", + "nullable": "nullable", + "description": null + }, + "char": { + "name": "char", + "type": "char", + "nullable": "nullable", + "description": null + }, + "date": { + "name": "date", + "type": "date", + "nullable": "nullable", + "description": null + }, + "float4": { + "name": "float4", + "type": "float4", + "nullable": "nullable", + "description": null + }, + "float8": { + "name": "float8", + "type": "float8", + "nullable": "nullable", + "description": null + }, + "int2": { + "name": "int2", + "type": "int2", + "nullable": "nullable", + "description": null + }, + "int4": { + "name": "int4", + "type": "int4", + "nullable": "nullable", + "description": null + }, + "int8": { + "name": "int8", + "type": "int8", + "nullable": "nullable", + "description": null + }, + "numeric": { + "name": "numeric", + "type": "numeric", + "nullable": "nullable", + "description": null + }, + "text": { + "name": "text", + "type": "text", + "nullable": "nullable", + "description": null + }, + "time": { + "name": "time", + "type": "time", + "nullable": "nullable", + "description": null + }, + "timestamp": { + "name": "timestamp", + "type": "timestamp", + "nullable": "nullable", + "description": null + }, + "timestamptz": { + "name": "timestamptz", + "type": "timestamptz", + "nullable": "nullable", + "description": null + }, + "timetz": { + "name": "timetz", + "type": "timetz", + "nullable": "nullable", + "description": null + }, + "uuid": { + "name": "uuid", + "type": "uuid", + "nullable": "nullable", + "description": null + }, + "varchar": { + "name": "varchar", + "type": "varchar", + "nullable": "nullable", + "description": null + } + }, + "description": null + } + }, + "aggregateFunctions": { + "bool": { + "bool_and": { + "returnType": "bool" + }, + "bool_or": { + "returnType": "bool" + }, + "every": { + "returnType": "bool" + } + }, + "date": { + "max": { + "returnType": "date" + }, + "min": { + "returnType": "date" + } + }, + "float4": { + "avg": { + "returnType": "float8" + }, + "max": { + "returnType": "float4" + }, + "min": { + "returnType": "float4" + }, + "stddev": { + "returnType": "float8" + }, + "stddev_pop": { + "returnType": "float8" + }, + "stddev_samp": { + "returnType": "float8" + }, + "sum": { + "returnType": "float4" + }, + "var_pop": { + "returnType": "float8" + }, + "var_samp": { + "returnType": "float8" + }, + "variance": { + "returnType": "float8" + } + }, + "float8": { + "avg": { + "returnType": "float8" + }, + "max": { + "returnType": "float8" + }, + "min": { + "returnType": "float8" + }, + "stddev": { + "returnType": "float8" + }, + "stddev_pop": { + "returnType": "float8" + }, + "stddev_samp": { + "returnType": "float8" + }, + "sum": { + "returnType": "float8" + }, + "var_pop": { + "returnType": "float8" + }, + "var_samp": { + "returnType": "float8" + }, + "variance": { + "returnType": "float8" + } + }, + "int2": { + "avg": { + "returnType": "numeric" + }, + "bit_and": { + "returnType": "int2" + }, + "bit_or": { + "returnType": "int2" + }, + "bit_xor": { + "returnType": "int2" + }, + "max": { + "returnType": "int2" + }, + "min": { + "returnType": "int2" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "int8" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "int4": { + "avg": { + "returnType": "numeric" + }, + "bit_and": { + "returnType": "int4" + }, + "bit_or": { + "returnType": "int4" + }, + "bit_xor": { + "returnType": "int4" + }, + "max": { + "returnType": "int4" + }, + "min": { + "returnType": "int4" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "int8" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "int8": { + "avg": { + "returnType": "numeric" + }, + "bit_and": { + "returnType": "int8" + }, + "bit_or": { + "returnType": "int8" + }, + "bit_xor": { + "returnType": "int8" + }, + "max": { + "returnType": "int8" + }, + "min": { + "returnType": "int8" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "numeric" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "numeric": { + "avg": { + "returnType": "numeric" + }, + "max": { + "returnType": "numeric" + }, + "min": { + "returnType": "numeric" + }, + "stddev": { + "returnType": "numeric" + }, + "stddev_pop": { + "returnType": "numeric" + }, + "stddev_samp": { + "returnType": "numeric" + }, + "sum": { + "returnType": "numeric" + }, + "var_pop": { + "returnType": "numeric" + }, + "var_samp": { + "returnType": "numeric" + }, + "variance": { + "returnType": "numeric" + } + }, + "text": { + "max": { + "returnType": "text" + }, + "min": { + "returnType": "text" + } + }, + "time": { + "max": { + "returnType": "time" + }, + "min": { + "returnType": "time" + } + }, + "timestamp": { + "max": { + "returnType": "timestamp" + }, + "min": { + "returnType": "timestamp" + } + }, + "timestamptz": { + "max": { + "returnType": "timestamptz" + }, + "min": { + "returnType": "timestamptz" + } + }, + "timetz": { + "max": { + "returnType": "timetz" + }, + "min": { + "returnType": "timetz" + } + } + }, + "comparisonOperators": { + "bool": { + "_eq": { + "operatorName": "=", + "argumentType": "bool" + }, + "_gt": { + "operatorName": ">", + "argumentType": "bool" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "bool" + }, + "_lt": { + "operatorName": "<", + "argumentType": "bool" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "bool" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "bool" + } + }, + "char": { + "_eq": { + "operatorName": "=", + "argumentType": "char" + }, + "_gt": { + "operatorName": ">", + "argumentType": "char" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "char" + }, + "_ilike": { + "operatorName": "~~*", + "argumentType": "char" + }, + "_iregex": { + "operatorName": "~*", + "argumentType": "char" + }, + "_like": { + "operatorName": "~~", + "argumentType": "char" + }, + "_lt": { + "operatorName": "<", + "argumentType": "char" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "char" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "char" + }, + "_nilike": { + "operatorName": "!~~*", + "argumentType": "char" + }, + "_niregex": { + "operatorName": "!~*", + "argumentType": "char" + }, + "_nlike": { + "operatorName": "!~~", + "argumentType": "char" + }, + "_nregex": { + "operatorName": "!~", + "argumentType": "char" + }, + "_regex": { + "operatorName": "~", + "argumentType": "char" + } + }, + "date": { + "_eq": { + "operatorName": "=", + "argumentType": "date" + }, + "_gt": { + "operatorName": ">", + "argumentType": "date" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "date" + }, + "_lt": { + "operatorName": "<", + "argumentType": "date" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "date" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "date" + } + }, + "float4": { + "_eq": { + "operatorName": "=", + "argumentType": "float4" + }, + "_gt": { + "operatorName": ">", + "argumentType": "float4" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "float4" + }, + "_lt": { + "operatorName": "<", + "argumentType": "float4" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "float4" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "float4" + } + }, + "float8": { + "_eq": { + "operatorName": "=", + "argumentType": "float8" + }, + "_gt": { + "operatorName": ">", + "argumentType": "float8" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "float8" + }, + "_lt": { + "operatorName": "<", + "argumentType": "float8" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "float8" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "float8" + } + }, + "int2": { + "_eq": { + "operatorName": "=", + "argumentType": "int2" + }, + "_gt": { + "operatorName": ">", + "argumentType": "int2" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "int2" + }, + "_lt": { + "operatorName": "<", + "argumentType": "int2" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "int2" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "int2" + } + }, + "int4": { + "_eq": { + "operatorName": "=", + "argumentType": "int4" + }, + "_gt": { + "operatorName": ">", + "argumentType": "int4" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "int4" + }, + "_lt": { + "operatorName": "<", + "argumentType": "int4" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "int4" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "int4" + } + }, + "int8": { + "_eq": { + "operatorName": "=", + "argumentType": "int8" + }, + "_gt": { + "operatorName": ">", + "argumentType": "int8" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "int8" + }, + "_lt": { + "operatorName": "<", + "argumentType": "int8" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "int8" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "int8" + } + }, + "name": { + "_eq": { + "operatorName": "=", + "argumentType": "name" + }, + "_gt": { + "operatorName": ">", + "argumentType": "name" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "name" + }, + "_ilike": { + "operatorName": "~~*", + "argumentType": "name" + }, + "_iregex": { + "operatorName": "~*", + "argumentType": "name" + }, + "_like": { + "operatorName": "~~", + "argumentType": "name" + }, + "_lt": { + "operatorName": "<", + "argumentType": "name" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "name" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "name" + }, + "_nilike": { + "operatorName": "!~~*", + "argumentType": "name" + }, + "_niregex": { + "operatorName": "!~*", + "argumentType": "name" + }, + "_nlike": { + "operatorName": "!~~", + "argumentType": "name" + }, + "_nregex": { + "operatorName": "!~", + "argumentType": "name" + }, + "_regex": { + "operatorName": "~", + "argumentType": "name" + } + }, + "numeric": { + "_eq": { + "operatorName": "=", + "argumentType": "numeric" + }, + "_gt": { + "operatorName": ">", + "argumentType": "numeric" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "numeric" + }, + "_lt": { + "operatorName": "<", + "argumentType": "numeric" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "numeric" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "numeric" + } + }, + "text": { + "_eq": { + "operatorName": "=", + "argumentType": "text" + }, + "_gt": { + "operatorName": ">", + "argumentType": "text" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "text" + }, + "_ilike": { + "operatorName": "~~*", + "argumentType": "text" + }, + "_iregex": { + "operatorName": "~*", + "argumentType": "text" + }, + "_like": { + "operatorName": "~~", + "argumentType": "text" + }, + "_lt": { + "operatorName": "<", + "argumentType": "text" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "text" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "text" + }, + "_nilike": { + "operatorName": "!~~*", + "argumentType": "text" + }, + "_niregex": { + "operatorName": "!~*", + "argumentType": "text" + }, + "_nlike": { + "operatorName": "!~~", + "argumentType": "text" + }, + "_nregex": { + "operatorName": "!~", + "argumentType": "text" + }, + "_regex": { + "operatorName": "~", + "argumentType": "text" + } + }, + "time": { + "_eq": { + "operatorName": "=", + "argumentType": "time" + }, + "_gt": { + "operatorName": ">", + "argumentType": "time" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "time" + }, + "_lt": { + "operatorName": "<", + "argumentType": "time" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "time" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "time" + } + }, + "timestamp": { + "_eq": { + "operatorName": "=", + "argumentType": "timestamp" + }, + "_gt": { + "operatorName": ">", + "argumentType": "timestamp" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "timestamp" + }, + "_lt": { + "operatorName": "<", + "argumentType": "timestamp" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "timestamp" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "timestamp" + } + }, + "timestamptz": { + "_eq": { + "operatorName": "=", + "argumentType": "timestamptz" + }, + "_gt": { + "operatorName": ">", + "argumentType": "timestamptz" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "timestamptz" + }, + "_lt": { + "operatorName": "<", + "argumentType": "timestamptz" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "timestamptz" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "timestamptz" + } + }, + "timetz": { + "_eq": { + "operatorName": "=", + "argumentType": "timetz" + }, + "_gt": { + "operatorName": ">", + "argumentType": "timetz" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "timetz" + }, + "_lt": { + "operatorName": "<", + "argumentType": "timetz" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "timetz" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "timetz" + } + }, + "uuid": { + "_eq": { + "operatorName": "=", + "argumentType": "uuid" + }, + "_gt": { + "operatorName": ">", + "argumentType": "uuid" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "uuid" + }, + "_lt": { + "operatorName": "<", + "argumentType": "uuid" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "uuid" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "uuid" + } + }, + "varchar": { + "_eq": { + "operatorName": "=", + "argumentType": "varchar" + }, + "_gt": { + "operatorName": ">", + "argumentType": "varchar" + }, + "_gte": { + "operatorName": ">=", + "argumentType": "varchar" + }, + "_ilike": { + "operatorName": "~~*", + "argumentType": "varchar" + }, + "_iregex": { + "operatorName": "~*", + "argumentType": "varchar" + }, + "_like": { + "operatorName": "~~", + "argumentType": "varchar" + }, + "_lt": { + "operatorName": "<", + "argumentType": "varchar" + }, + "_lte": { + "operatorName": "<=", + "argumentType": "varchar" + }, + "_neq": { + "operatorName": "<>", + "argumentType": "varchar" + }, + "_nilike": { + "operatorName": "!~~*", + "argumentType": "varchar" + }, + "_niregex": { + "operatorName": "!~*", + "argumentType": "varchar" + }, + "_nlike": { + "operatorName": "!~~", + "argumentType": "varchar" + }, + "_nregex": { + "operatorName": "!~", + "argumentType": "varchar" + }, + "_regex": { + "operatorName": "~", + "argumentType": "varchar" + } + } + } + }, + "configureOptions": { + "excludedSchemas": [ + "information_schema", + "pg_catalog", + "tiger", + "crdb_internal", + "columnar", + "columnar_internal" + ], + "unqualifiedSchemas": ["public"], + "comparisonOperatorMapping": [ + { + "operatorName": "=", + "exposedName": "_eq" + }, + { + "operatorName": "<=", + "exposedName": "_lte" + }, + { + "operatorName": ">", + "exposedName": "_gt" + }, + { + "operatorName": ">=", + "exposedName": "_gte" + }, + { + "operatorName": "<", + "exposedName": "_lt" + }, + { + "operatorName": "!=", + "exposedName": "_neq" + }, + { + "operatorName": "LIKE", + "exposedName": "_like" + }, + { + "operatorName": "NOT LIKE", + "exposedName": "_nlike" + }, + { + "operatorName": "ILIKE", + "exposedName": "_ilike" + }, + { + "operatorName": "NOT ILIKE", + "exposedName": "_nilike" + }, + { + "operatorName": "SIMILAR TO", + "exposedName": "_similar" + }, + { + "operatorName": "NOT SIMILAR TO", + "exposedName": "_nsimilar" + }, + { + "operatorName": "<>", + "exposedName": "_neq" + }, + { + "operatorName": "~~", + "exposedName": "_like" + }, + { + "operatorName": "!~~", + "exposedName": "_nlike" + }, + { + "operatorName": "~~*", + "exposedName": "_ilike" + }, + { + "operatorName": "!~~*", + "exposedName": "_nilike" + }, + { + "operatorName": "~", + "exposedName": "_regex" + }, + { + "operatorName": "!~", + "exposedName": "_nregex" + }, + { + "operatorName": "~*", + "exposedName": "_iregex" + }, + { + "operatorName": "!~*", + "exposedName": "_niregex" + } + ] + } +} diff --git a/static/postgres/chinook-metadata.json b/static/postgres/chinook-metadata.json index dce5f326..8de96e09 100644 --- a/static/postgres/chinook-metadata.json +++ b/static/postgres/chinook-metadata.json @@ -259,6 +259,96 @@ } } } + }, + "v1_insert_custom_dog_object": { + "description": "A dog", + "fields": { + "name": { + "description": "The dog's name", + "arguments": {}, + "type": { + "type": "named", + "name": "text" + } + }, + "birthday": { + "description": "The dog's birthday", + "arguments": {}, + "type": { + "type": "named", + "name": "date" + } + }, + "height_cm": { + "description": "The dog's height in centimeters", + "arguments": {}, + "type": { + "type": "named", + "name": "numeric" + } + }, + "adopter_name": { + "description": "The dog's adopter's name", + "arguments": {}, + "type": { + "type": "named", + "name": "text" + } + } + } + }, + "custom_dog": { + "description": "A dog", + "fields": { + "id": { + "description": "The dog's id", + "arguments": {}, + "type": { + "type": "named", + "name": "int8" + } + }, + "name": { + "description": "The dog's name", + "arguments": {}, + "type": { + "type": "named", + "name": "text" + } + }, + "birthday": { + "description": "The dog's birthday", + "arguments": {}, + "type": { + "type": "named", + "name": "date" + } + }, + "height_cm": { + "description": "The dog's height in centimeters", + "arguments": {}, + "type": { + "type": "named", + "name": "numeric" + } + }, + "height_in": { + "description": "The dog's height in inches", + "arguments": {}, + "type": { + "type": "named", + "name": "numeric" + } + }, + "adopter_name": { + "description": "The dog's adopter's name", + "arguments": {}, + "type": { + "type": "named", + "name": "text" + } + } + } } }, "collections": [ @@ -350,6 +440,29 @@ } } } + }, + { + "name": "v1_insert_custom_dog", + "description": "Insert a dog", + "arguments": { + "_object": { + "description": "The dog to insert", + "type": { + "type": "named", + "name": "v1_insert_custom_dog_object" + } + } + }, + "result_type": { + "type": "nullable", + "underlying_type": { + "type": "array", + "element_type": { + "type": "named", + "name": "custom_dog" + } + } + } } ] } @@ -357,6 +470,71 @@ "version": "v1", "kind": "DataConnector" }, + { + "definition": { + "name": "v1_insert_custom_dog_object", + "fields": [ + { + "name": "name", + "type": "String!" + }, + { + "name": "birthday", + "type": "String" + }, + { + "name": "adopter_name", + "type": "String" + }, + { + "name": "height_cm", + "type": "Int!" + } + ], + "graphql": { + "typeName": "v1_insert_custom_dog_object", + "inputTypeName": "v1_insert_custom_dog_objectInput" + } + }, + "version": "v1", + "kind": "ObjectType" + }, + { + "definition": { + "name": "custom_dog", + "fields": [ + { + "name": "id", + "type": "Int" + }, + { + "name": "name", + "type": "String" + }, + { + "name": "birthday", + "type": "String" + }, + { + "name": "adopter_name", + "type": "String" + }, + { + "name": "height_cm", + "type": "Int" + }, + { + "name": "height_in", + "type": "Int" + } + ], + "graphql": { + "typeName": "custom_dog" + } + }, + "version": "v1", + "kind": "ObjectType" + }, { "definition": { "name": "Artist", @@ -740,6 +918,70 @@ "version": "v1", "kind": "Model" }, + { + "kind": "CommandPermissions", + "version": "v1", + "definition": { + "commandName": "v1_insert_custom_dog", + "permissions": [ + { + "role": "admin", + "allowExecution": true + } + ] + } + }, + { + "kind": "Command", + "version": "v1", + "definition": { + "name": "v1_insert_custom_dog", + "arguments": [ + { + "name": "_object", + "type": "v1_insert_custom_dog_object" + } + ], + "outputType": "[custom_dog]", + "source": { + "dataConnectorName": "db", + "dataConnectorCommand": { + "procedure": "v1_insert_custom_dog" + }, + "typeMapping": { + "custom_dog": { + "fieldMapping": { + "id": { + "column": "id" + }, + "name": { + "column": "name" + }, + "birthday": { + "column": "birthday" + }, + "height_cm": { + "column": "height_cm" + }, + "height_in": { + "column": "height_in" + }, + "adopter_name": { + "column": "adopter_name" + } + } + } + }, + "argumentMapping": { + "_object": "_object" + } + }, + "graphql": { + "rootFieldName": "v1_insert_custom_dog", + "rootFieldKind": "Mutation" + } + } + }, { "kind": "CommandPermissions", "version": "v1", @@ -801,6 +1043,28 @@ } } }, + { + "definition": { + "typeName": "custom_dog", + "permissions": [ + { + "role": "admin", + "output": { + "allowedFields": [ + "id", + "name", + "birthday", + "adopter_name", + "height_cm", + "height_in" + ] + } + } + ] + }, + "version": "v1", + "kind": "TypePermissions" + }, { "definition": { "typeName": "Artist", diff --git a/static/postgres/v2-chinook-ndc-metadata.json b/static/postgres/v2-chinook-ndc-metadata.json index 36fcb9f2..d2c01d8d 100644 --- a/static/postgres/v2-chinook-ndc-metadata.json +++ b/static/postgres/v2-chinook-ndc-metadata.json @@ -725,6 +725,69 @@ }, "description": null }, + "custom_dog": { + "schemaName": "custom", + "tableName": "dog", + "columns": { + "adopter_name": { + "name": "adopter_name", + "type": { + "scalarType": "text" + }, + "nullable": "nullable", + "description": null + }, + "birthday": { + "name": "birthday", + "type": { + "scalarType": "date" + }, + "nullable": "nonNullable", + "hasDefault": "hasDefault", + "description": null + }, + "height_cm": { + "name": "height_cm", + "type": { + "scalarType": "numeric" + }, + "nullable": "nonNullable", + "description": null + }, + "height_in": { + "name": "height_in", + "type": { + "scalarType": "numeric" + }, + "nullable": "nullable", + "hasDefault": "hasDefault", + "isGenerated": "stored", + "description": null + }, + "id": { + "name": "id", + "type": { + "scalarType": "int8" + }, + "nullable": "nonNullable", + "isIdentity": "identityAlways", + "description": null + }, + "name": { + "name": "name", + "type": { + "scalarType": "text" + }, + "nullable": "nonNullable", + "description": null + } + }, + "uniquenessConstraints": { + "dog_pkey": ["id"] + }, + "foreignRelations": {}, + "description": null + }, "spatial_ref_sys": { "schemaName": "public", "tableName": "spatial_ref_sys",