From b51c2fa47436c412816af0f62a2efc931c7b9fb0 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Wed, 28 Jul 2021 19:01:22 +0800 Subject: [PATCH 01/21] Move files --- Cargo.toml | 2 +- tests/discovery/{ => mysql}/Cargo.toml | 4 ++-- tests/discovery/{ => mysql}/Readme.md | 0 tests/discovery/{ => mysql}/schema.rs | 0 tests/discovery/{ => mysql}/src/main.rs | 0 5 files changed, 3 insertions(+), 3 deletions(-) rename tests/discovery/{ => mysql}/Cargo.toml (54%) rename tests/discovery/{ => mysql}/Readme.md (100%) rename tests/discovery/{ => mysql}/schema.rs (100%) rename tests/discovery/{ => mysql}/src/main.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index b8a6acc2..191153cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ ".", - "tests/discovery", + "tests/discovery/mysql", "tests/writer", ] diff --git a/tests/discovery/Cargo.toml b/tests/discovery/mysql/Cargo.toml similarity index 54% rename from tests/discovery/Cargo.toml rename to tests/discovery/mysql/Cargo.toml index 49cef6b4..9f782c81 100644 --- a/tests/discovery/Cargo.toml +++ b/tests/discovery/mysql/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "sea-schema-discovery-test" +name = "sea-schema-discovery-test-mysql" version = "0.1.0" edition = "2018" publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } -sea-schema = { path = "../../", default-features = false, features = [ "with-serde", "sqlx-mysql", "runtime-async-std-native-tls", "discovery" ] } +sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-mysql", "runtime-async-std-native-tls", "discovery" ] } sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/discovery/Readme.md b/tests/discovery/mysql/Readme.md similarity index 100% rename from tests/discovery/Readme.md rename to tests/discovery/mysql/Readme.md diff --git a/tests/discovery/schema.rs b/tests/discovery/mysql/schema.rs similarity index 100% rename from tests/discovery/schema.rs rename to tests/discovery/mysql/schema.rs diff --git a/tests/discovery/src/main.rs b/tests/discovery/mysql/src/main.rs similarity index 100% rename from tests/discovery/src/main.rs rename to tests/discovery/mysql/src/main.rs From 322694c3133840065a930b7047e5d34c1af82de0 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Wed, 28 Jul 2021 23:27:33 +0800 Subject: [PATCH 02/21] WIP --- Cargo.toml | 1 + src/postgres/discovery/executor/mock.rs | 28 +++++ src/postgres/discovery/executor/mod.rs | 9 ++ src/postgres/discovery/executor/real.rs | 35 ++++++ src/postgres/discovery/mod.rs | 144 ++++++++++++++++++++++++ src/postgres/mod.rs | 12 +- src/postgres/parser/mod.rs | 1 + src/postgres/query/column.rs | 8 +- src/postgres/query/constraints/mod.rs | 9 +- src/postgres/query/table.rs | 4 +- src/postgres/writer/mod.rs | 1 + tests/discovery/postgres/Cargo.toml | 12 ++ tests/discovery/postgres/Readme.md | 5 + tests/discovery/postgres/src/main.rs | 17 +++ 14 files changed, 275 insertions(+), 11 deletions(-) create mode 100644 src/postgres/discovery/executor/mock.rs create mode 100644 src/postgres/discovery/executor/mod.rs create mode 100644 src/postgres/discovery/executor/real.rs create mode 100644 src/postgres/discovery/mod.rs create mode 100644 src/postgres/writer/mod.rs create mode 100644 tests/discovery/postgres/Cargo.toml create mode 100644 tests/discovery/postgres/Readme.md create mode 100644 tests/discovery/postgres/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 191153cd..0c5135d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ members = [ ".", "tests/discovery/mysql", + "tests/discovery/postgres", "tests/writer", ] diff --git a/src/postgres/discovery/executor/mock.rs b/src/postgres/discovery/executor/mock.rs new file mode 100644 index 00000000..62cdec85 --- /dev/null +++ b/src/postgres/discovery/executor/mock.rs @@ -0,0 +1,28 @@ +use crate::sqlx_types::{postgres::PgRow, PgPool}; +use sea_query::{PostgresQueryBuilder, SelectStatement}; + +use crate::debug_print; + +pub struct Executor { + pool: PgPool, +} + +pub trait IntoExecutor { + fn into_executor(self) -> Executor; +} + +impl IntoExecutor for PgPool { + fn into_executor(self) -> Executor { + Executor { pool: self } + } +} + +impl Executor { + pub async fn fetch_all(&self, select: SelectStatement) -> Vec { + let (sql, values) = select.build(PostgresQueryBuilder); + debug_print!("{}, {:?}", sql, values); + debug_print!(); + + panic!("This is a mock Executor"); + } +} diff --git a/src/postgres/discovery/executor/mod.rs b/src/postgres/discovery/executor/mod.rs new file mode 100644 index 00000000..86811f01 --- /dev/null +++ b/src/postgres/discovery/executor/mod.rs @@ -0,0 +1,9 @@ +#[cfg(feature = "sqlx-postgres")] +mod real; +#[cfg(feature = "sqlx-postgres")] +pub use real::*; + +#[cfg(not(feature = "sqlx-postgres"))] +mod mock; +#[cfg(not(feature = "sqlx-postgres"))] +pub use mock::*; diff --git a/src/postgres/discovery/executor/real.rs b/src/postgres/discovery/executor/real.rs new file mode 100644 index 00000000..203293ff --- /dev/null +++ b/src/postgres/discovery/executor/real.rs @@ -0,0 +1,35 @@ +use sea_query::{PostgresQueryBuilder, SelectStatement}; +use sqlx::{postgres::PgRow, PgPool}; + +sea_query::sea_query_driver_postgres!(); +use sea_query_driver_postgres::bind_query; + +use crate::debug_print; + +pub struct Executor { + pool: PgPool, +} + +pub trait IntoExecutor { + fn into_executor(self) -> Executor; +} + +impl IntoExecutor for PgPool { + fn into_executor(self) -> Executor { + Executor { pool: self } + } +} + +impl Executor { + pub async fn fetch_all(&self, select: SelectStatement) -> Vec { + let (sql, values) = select.build(PostgresQueryBuilder); + debug_print!("{}, {:?}", sql, values); + debug_print!(); + + let query = bind_query(sqlx::query(&sql), &values); + query + .fetch_all(&mut self.pool.acquire().await.unwrap()) + .await + .unwrap() + } +} diff --git a/src/postgres/discovery/mod.rs b/src/postgres/discovery/mod.rs new file mode 100644 index 00000000..a784e1ca --- /dev/null +++ b/src/postgres/discovery/mod.rs @@ -0,0 +1,144 @@ +//! To query & parse MySQL's INFORMATION_SCHEMA and construct a [`Schema`] + +use crate::debug_print; +use crate::postgres::def::*; +use crate::postgres::query::{ + ColumnQueryResult, SchemaQueryBuilder, TableConstraintsQueryResult, TableQueryResult, +}; +use futures::future; +use sea_query::{Alias, Iden, IntoIden}; +use std::rc::Rc; + +mod executor; +pub use executor::*; + +pub struct SchemaDiscovery { + pub query: SchemaQueryBuilder, + pub executor: Executor, + pub schema: Rc, +} + +impl SchemaDiscovery { + pub fn new(executor: E, schema: &str) -> Self + where + E: IntoExecutor, + { + Self { + query: SchemaQueryBuilder::default(), + executor: executor.into_executor(), + schema: Alias::new(schema).into_iden(), + } + } + + pub async fn discover(mut self) -> Schema { + let tables = self.discover_tables().await; + let tables = future::join_all( + tables + .into_iter() + .map(|t| (&self, t)) + .map(Self::discover_table_static), + ) + .await; + + Schema { + schema: self.schema.to_string(), + tables, + } + } + + pub async fn discover_tables(&mut self) -> Vec { + let rows = self + .executor + .fetch_all(self.query.query_tables(self.schema.clone())) + .await; + + let tables: Vec = rows + .iter() + .map(|row| { + let result: TableQueryResult = row.into(); + debug_print!("{:?}", result); + let table = result.parse(); + debug_print!("{:?}", table); + table + }) + .collect(); + + debug_print!(); + tables + } + + async fn discover_table_static(params: (&Self, TableInfo)) -> TableDef { + let this = params.0; + let info = params.1; + Self::discover_table(this, info).await + } + + pub async fn discover_table(&self, info: TableInfo) -> TableDef { + let table = Rc::new(Alias::new(info.name.as_str())); + let columns = self + .discover_columns(self.schema.clone(), table.clone()) + .await; + let (check_constraints, unique_keys, references) = self + .discover_constraints(self.schema.clone(), table.clone()) + .await; + + TableDef { + info, + columns, + check_constraints, + unique_keys, + references, + of_type: None, + } + } + + pub async fn discover_columns( + &self, + schema: Rc, + table: Rc, + ) -> Vec { + let rows = self + .executor + .fetch_all(self.query.query_columns(schema.clone(), table.clone())) + .await; + + let columns = rows + .iter() + .map(|row| { + let result: ColumnQueryResult = row.into(); + debug_print!("{:?}", result); + let column = result.parse(); + debug_print!("{:?}", column); + return column; + }) + .collect::>(); + + debug_print!(); + columns + } + + pub async fn discover_constraints( + &self, + schema: Rc, + table: Rc, + ) -> (Vec, Vec, Vec) { + // let rows = self + // .executor + // .fetch_all(self.query.discover_constraints(schema.clone(), table.clone())) + // .await; + + // let constraints: Vec = rows + // .iter() + // .map(|row| { + // let result: TableConstraintsQueryResult = row.into(); + // debug_print!("{:?}", result); + // let constraint = result.parse(); + // debug_print!("{:?}", result); + // constraint + // }) + // .collect(); + // debug_print!(); + + (Vec::new(), Vec::new(), Vec::new()) + } +} diff --git a/src/postgres/mod.rs b/src/postgres/mod.rs index 620011e5..c38c9e64 100644 --- a/src/postgres/mod.rs +++ b/src/postgres/mod.rs @@ -1,11 +1,19 @@ #[cfg(feature = "def")] -#[cfg_attr(docsr, doc(cfg(feature = "def")))] +#[cfg_attr(docsrs, doc(cfg(feature = "def")))] pub mod def; +#[cfg(feature = "discovery")] +#[cfg_attr(docsrs, doc(cfg(feature = "discovery")))] +pub mod discovery; + #[cfg(feature = "parser")] #[cfg_attr(docsrs, doc(cfg(feature = "parser")))] pub mod parser; #[cfg(feature = "query")] -#[cfg_attr(docsr, doc(cfg(feature = "query")))] +#[cfg_attr(docsrs, doc(cfg(feature = "query")))] pub mod query; + +#[cfg(feature = "writer")] +#[cfg_attr(docsrs, doc(cfg(feature = "writer")))] +pub mod writer; diff --git a/src/postgres/parser/mod.rs b/src/postgres/parser/mod.rs index fcd32b93..c3583df6 100644 --- a/src/postgres/parser/mod.rs +++ b/src/postgres/parser/mod.rs @@ -4,6 +4,7 @@ mod table_constraints; pub use column::*; pub use table::*; +pub use table_constraints::*; fn yes_or_no_to_bool(string: &str) -> bool { matches!(string.to_uppercase().as_str(), "YES") diff --git a/src/postgres/query/column.rs b/src/postgres/query/column.rs index 38f24f89..dc9ae37e 100644 --- a/src/postgres/query/column.rs +++ b/src/postgres/query/column.rs @@ -39,7 +39,7 @@ pub enum ColumnsField { IdentityMinimum, IdentityCycle, IsGenerated, - GeneratedExpression, + GenerationExpression, IsUpdatable, } @@ -64,7 +64,7 @@ impl SchemaQueryBuilder { ColumnsField::ColumnName, ColumnsField::DataType, ColumnsField::ColumnDefault, - ColumnsField::GeneratedExpression, + ColumnsField::GenerationExpression, ColumnsField::IsNullable, ColumnsField::NumericPrecision, ColumnsField::NumericPrecisionRadix, @@ -77,7 +77,7 @@ impl SchemaQueryBuilder { } } -#[cfg(feature = "sqlx-postres")] +#[cfg(feature = "sqlx-postgres")] impl From<&PgRow> for ColumnQueryResult { fn from(row: &PgRow) -> Self { Self { @@ -93,7 +93,7 @@ impl From<&PgRow> for ColumnQueryResult { } } -#[cfg(not(feature = "sqlx-postres"))] +#[cfg(not(feature = "sqlx-postgres"))] impl From<&PgRow> for ColumnQueryResult { fn from(row: &PgRow) -> Self { Self::default() diff --git a/src/postgres/query/constraints/mod.rs b/src/postgres/query/constraints/mod.rs index d5f00733..185aabba 100644 --- a/src/postgres/query/constraints/mod.rs +++ b/src/postgres/query/constraints/mod.rs @@ -9,7 +9,10 @@ pub use referential_constraints::*; pub use table_constraints::*; use super::{InformationSchema, SchemaQueryBuilder}; -use crate::sqlx_types::{postgres::PgRow, Row}; +use crate::{ + postgres::def::Constraint, + sqlx_types::{postgres::PgRow, Row}, +}; use sea_query::{Alias, Expr, Iden, JoinType, Order, Query, SelectStatement}; use std::rc::Rc; @@ -130,7 +133,7 @@ impl SchemaQueryBuilder { } } -#[cfg(feature = "sqlx-postres")] +#[cfg(feature = "sqlx-postgres")] impl From<&PgRow> for TableConstraintsQueryResult { fn from(row: &PgRow) -> Self { Self { @@ -160,7 +163,7 @@ impl From<&PgRow> for TableConstraintsQueryResult { } } -#[cfg(not(feature = "sqlx-postres"))] +#[cfg(not(feature = "sqlx-postgres"))] impl From<&PgRow> for TableConstraintsQueryResult { fn from(_row: &PgRow) -> Self { Self::default() diff --git a/src/postgres/query/table.rs b/src/postgres/query/table.rs index ea3ac4e3..087f9a58 100644 --- a/src/postgres/query/table.rs +++ b/src/postgres/query/table.rs @@ -51,7 +51,7 @@ impl SchemaQueryBuilder { } } -#[cfg(feature = "sqlx-postres")] +#[cfg(feature = "sqlx-postgres")] impl From<&PgRow> for TableQueryResult { fn from(row: &PgRow) -> Self { Self { @@ -62,7 +62,7 @@ impl From<&PgRow> for TableQueryResult { } } -#[cfg(not(feature = "sqlx-postres"))] +#[cfg(not(feature = "sqlx-postgres"))] impl From<&PgRow> for TableQueryResult { fn from(row: &PgRow) -> Self { Self::default() diff --git a/src/postgres/writer/mod.rs b/src/postgres/writer/mod.rs new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/postgres/writer/mod.rs @@ -0,0 +1 @@ + diff --git a/tests/discovery/postgres/Cargo.toml b/tests/discovery/postgres/Cargo.toml new file mode 100644 index 00000000..95ab5751 --- /dev/null +++ b/tests/discovery/postgres/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "sea-schema-discovery-test-postgres" +version = "0.1.0" +edition = "2018" +publish = false + +[dependencies] +async-std = { version = "1.8", features = [ "attributes" ] } +sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "debug-print" ] } +sea-query = { version = "^0.12" } +serde_json = { version = "^1" } +sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/discovery/postgres/Readme.md b/tests/discovery/postgres/Readme.md new file mode 100644 index 00000000..f75aafcf --- /dev/null +++ b/tests/discovery/postgres/Readme.md @@ -0,0 +1,5 @@ +# Run + +```sh +cargo run > schema.rs +``` \ No newline at end of file diff --git a/tests/discovery/postgres/src/main.rs b/tests/discovery/postgres/src/main.rs new file mode 100644 index 00000000..2f9735de --- /dev/null +++ b/tests/discovery/postgres/src/main.rs @@ -0,0 +1,17 @@ +use sea_schema::postgres::discovery::SchemaDiscovery; +use sqlx::PgPool; + +#[async_std::main] +async fn main() { + let connection = PgPool::connect("postgres://sea:sea@localhost/sakila") + .await + .unwrap(); + + let schema_discovery = SchemaDiscovery::new(connection, "public"); + + let schema = schema_discovery.discover().await; + + // println!("{}", serde_json::to_string_pretty(&schema).unwrap()); + + println!("{:#?}", schema); +} From 5f2961bc9b39adb0d6fb9b2daf0f672858a127a0 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Wed, 28 Jul 2021 23:31:41 +0800 Subject: [PATCH 03/21] Hotfix --- src/sqlx_types/mock.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sqlx_types/mock.rs b/src/sqlx_types/mock.rs index b107605f..cbcd37d2 100644 --- a/src/sqlx_types/mock.rs +++ b/src/sqlx_types/mock.rs @@ -4,6 +4,8 @@ pub mod mysql { pub struct MySqlRow; } +pub struct PgPool; + pub mod postgres { pub struct PgRow; } From f69a0593c54cbcce1e698f518b5d25e41feb2092 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 29 Jul 2021 13:11:37 +0800 Subject: [PATCH 04/21] WIP --- src/postgres/def/constraints.rs | 1 + src/postgres/discovery/mod.rs | 52 ++++++++++++++++-------- src/postgres/parser/table_constraints.rs | 1 + src/postgres/query/constraints/mod.rs | 4 +- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/postgres/def/constraints.rs b/src/postgres/def/constraints.rs index 1b9424de..a1c3d1dd 100644 --- a/src/postgres/def/constraints.rs +++ b/src/postgres/def/constraints.rs @@ -27,6 +27,7 @@ pub struct Check { #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] /// The constraint that a value must not be null pub struct NotNull; + impl NotNull { pub fn from_bool(boolean: bool) -> Option { if boolean { diff --git a/src/postgres/discovery/mod.rs b/src/postgres/discovery/mod.rs index a784e1ca..0c2140cc 100644 --- a/src/postgres/discovery/mod.rs +++ b/src/postgres/discovery/mod.rs @@ -2,6 +2,7 @@ use crate::debug_print; use crate::postgres::def::*; +use crate::postgres::parser::parse_table_constraint_query_results; use crate::postgres::query::{ ColumnQueryResult, SchemaQueryBuilder, TableConstraintsQueryResult, TableQueryResult, }; @@ -122,23 +123,38 @@ impl SchemaDiscovery { schema: Rc, table: Rc, ) -> (Vec, Vec, Vec) { - // let rows = self - // .executor - // .fetch_all(self.query.discover_constraints(schema.clone(), table.clone())) - // .await; - - // let constraints: Vec = rows - // .iter() - // .map(|row| { - // let result: TableConstraintsQueryResult = row.into(); - // debug_print!("{:?}", result); - // let constraint = result.parse(); - // debug_print!("{:?}", result); - // constraint - // }) - // .collect(); - // debug_print!(); - - (Vec::new(), Vec::new(), Vec::new()) + let rows = self + .executor + .fetch_all(self.query.query_table_constriants(schema.clone(), table.clone())) + .await; + + let results: Vec = rows + .iter() + .map(|row| { + let result = row.into(); + debug_print!("{:?}", result); + result + }) + .collect(); + debug_print!(); + + let constraints = parse_table_constraint_query_results(Box::new(results.into_iter())) + .map(|index| { + debug_print!("{:?}", index); + index + }) + .collect::>(); + debug_print!(); + + constraints.into_iter() + .fold((Vec::new(), Vec::new(), Vec::new()), |mut acc, constraint| { + match constraint { + Constraint::Check(check) => acc.0.push(check), + Constraint::Unique(unique) => acc.1.push(unique), + Constraint::References(references) => acc.2.push(references), + _ => {}, + } + acc + }) } } diff --git a/src/postgres/parser/table_constraints.rs b/src/postgres/parser/table_constraints.rs index 1997fadc..d30f54ae 100644 --- a/src/postgres/parser/table_constraints.rs +++ b/src/postgres/parser/table_constraints.rs @@ -103,6 +103,7 @@ impl Iterator for TableConstraintsQueryResultParser { Some(Constraint::PrimaryKey(PrimaryKey(columns))) } + _ => { // FIXME: Invalid input error handling None diff --git a/src/postgres/query/constraints/mod.rs b/src/postgres/query/constraints/mod.rs index 185aabba..12abf7e5 100644 --- a/src/postgres/query/constraints/mod.rs +++ b/src/postgres/query/constraints/mod.rs @@ -48,7 +48,7 @@ pub struct TableConstraintsQueryResult { } impl SchemaQueryBuilder { - pub fn query_table_constriants(schema: Rc, table: Rc) -> SelectStatement { + pub fn query_table_constriants(&self, schema: Rc, table: Rc) -> SelectStatement { type Schema = InformationSchema; type Tcf = TableConstraintsField; type Cf = CheckConstraintsFields; @@ -61,6 +61,8 @@ impl SchemaQueryBuilder { .columns(vec![ (Schema::TableConstraints, Tcf::ConstraintSchema), (Schema::TableConstraints, Tcf::ConstraintName), + (Schema::TableConstraints, Tcf::TableSchema), + (Schema::TableConstraints, Tcf::TableName), (Schema::TableConstraints, Tcf::ConstraintType), (Schema::TableConstraints, Tcf::IsDeferrable), (Schema::TableConstraints, Tcf::InitiallyDeferred), From 81852583dcabba4788d8398dd819869c9522ff22 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 29 Jul 2021 22:26:15 +0800 Subject: [PATCH 05/21] WIP --- src/postgres/def/schema.rs | 1 + src/postgres/discovery/mod.rs | 32 ++++++++++++++---------- src/postgres/parser/table_constraints.rs | 12 ++++----- src/postgres/query/constraints/mod.rs | 6 ++++- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/src/postgres/def/schema.rs b/src/postgres/def/schema.rs index e5e158ad..731316b1 100644 --- a/src/postgres/def/schema.rs +++ b/src/postgres/def/schema.rs @@ -20,6 +20,7 @@ pub struct TableDef { pub unique_keys: Vec, pub references: Vec, + // FIXME: Duplication? TableInfo also have of_type pub of_type: Option, // TODO: // pub inherets: Vec, diff --git a/src/postgres/discovery/mod.rs b/src/postgres/discovery/mod.rs index 0c2140cc..927fdad3 100644 --- a/src/postgres/discovery/mod.rs +++ b/src/postgres/discovery/mod.rs @@ -79,9 +79,21 @@ impl SchemaDiscovery { let columns = self .discover_columns(self.schema.clone(), table.clone()) .await; - let (check_constraints, unique_keys, references) = self + let constraints = self .discover_constraints(self.schema.clone(), table.clone()) .await; + let (check_constraints, unique_keys, references) = constraints.into_iter().fold( + (Vec::new(), Vec::new(), Vec::new()), + |mut acc, constraint| { + match constraint { + Constraint::Check(check) => acc.0.push(check), + Constraint::Unique(unique) => acc.1.push(unique), + Constraint::References(references) => acc.2.push(references), + _ => {} + } + acc + }, + ); TableDef { info, @@ -122,10 +134,13 @@ impl SchemaDiscovery { &self, schema: Rc, table: Rc, - ) -> (Vec, Vec, Vec) { + ) -> Vec { let rows = self .executor - .fetch_all(self.query.query_table_constriants(schema.clone(), table.clone())) + .fetch_all( + self.query + .query_table_constriants(schema.clone(), table.clone()), + ) .await; let results: Vec = rows @@ -146,15 +161,6 @@ impl SchemaDiscovery { .collect::>(); debug_print!(); - constraints.into_iter() - .fold((Vec::new(), Vec::new(), Vec::new()), |mut acc, constraint| { - match constraint { - Constraint::Check(check) => acc.0.push(check), - Constraint::Unique(unique) => acc.1.push(unique), - Constraint::References(references) => acc.2.push(references), - _ => {}, - } - acc - }) + constraints } } diff --git a/src/postgres/parser/table_constraints.rs b/src/postgres/parser/table_constraints.rs index d30f54ae..29520ff7 100644 --- a/src/postgres/parser/table_constraints.rs +++ b/src/postgres/parser/table_constraints.rs @@ -31,7 +31,7 @@ impl Iterator for TableConstraintsQueryResultParser { return None; }; - let constriant_name = result.constraint_name; + let constraint_name = result.constraint_name; match result.constraint_type.as_str() { "CHECK" => { Some(Constraint::Check(Check { @@ -50,7 +50,7 @@ impl Iterator for TableConstraintsQueryResultParser { foreign_columns.push(result.referential_key_column_name.unwrap()); while let Some(result) = self.results.next() { - if result.constraint_name != constriant_name { + if result.constraint_name != constraint_name { self.curr = Some(result); return Some(Constraint::References(References { columns, @@ -76,7 +76,7 @@ impl Iterator for TableConstraintsQueryResultParser { columns.push(result.column_name.unwrap()); while let Some(result) = self.results.next() { - if result.constraint_name != constriant_name { + if result.constraint_name != constraint_name { self.curr = Some(result); return Some(Constraint::PrimaryKey(PrimaryKey(columns))); } @@ -93,15 +93,15 @@ impl Iterator for TableConstraintsQueryResultParser { columns.push(result.column_name.unwrap()); while let Some(result) = self.results.next() { - if result.constraint_name != constriant_name { + if result.constraint_name != constraint_name { self.curr = Some(result); - return Some(Constraint::PrimaryKey(PrimaryKey(columns))); + return Some(Constraint::Unique(Unique(columns))); } columns.push(result.column_name.unwrap()); } - Some(Constraint::PrimaryKey(PrimaryKey(columns))) + Some(Constraint::Unique(Unique(columns))) } _ => { diff --git a/src/postgres/query/constraints/mod.rs b/src/postgres/query/constraints/mod.rs index 12abf7e5..9531258d 100644 --- a/src/postgres/query/constraints/mod.rs +++ b/src/postgres/query/constraints/mod.rs @@ -48,7 +48,11 @@ pub struct TableConstraintsQueryResult { } impl SchemaQueryBuilder { - pub fn query_table_constriants(&self, schema: Rc, table: Rc) -> SelectStatement { + pub fn query_table_constriants( + &self, + schema: Rc, + table: Rc, + ) -> SelectStatement { type Schema = InformationSchema; type Tcf = TableConstraintsField; type Cf = CheckConstraintsFields; From 80e5acd1b92bba624e23df3ca85b05f2529e1af8 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 29 Jul 2021 22:46:24 +0800 Subject: [PATCH 06/21] Move files --- Cargo.toml | 2 +- tests/writer/{ => mysql}/Cargo.toml | 4 ++-- tests/writer/{ => mysql}/Readme.md | 0 tests/writer/{ => mysql}/src/main.rs | 0 4 files changed, 3 insertions(+), 3 deletions(-) rename tests/writer/{ => mysql}/Cargo.toml (55%) rename tests/writer/{ => mysql}/Readme.md (100%) rename tests/writer/{ => mysql}/src/main.rs (100%) diff --git a/Cargo.toml b/Cargo.toml index 0c5135d6..31b06300 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [ ".", "tests/discovery/mysql", "tests/discovery/postgres", - "tests/writer", + "tests/writer/mysql", ] [package] diff --git a/tests/writer/Cargo.toml b/tests/writer/mysql/Cargo.toml similarity index 55% rename from tests/writer/Cargo.toml rename to tests/writer/mysql/Cargo.toml index 8fa5815e..96f3007b 100644 --- a/tests/writer/Cargo.toml +++ b/tests/writer/mysql/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "sea-schema-writer-test" +name = "sea-schema-writer-test-mysql" version = "0.1.0" edition = "2018" publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } -sea-schema = { path = "../../", default-features = false, features = [ "sqlx-mysql", "runtime-async-std-native-tls", "discovery", "writer" ] } +sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-mysql", "runtime-async-std-native-tls", "discovery", "writer" ] } sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/writer/Readme.md b/tests/writer/mysql/Readme.md similarity index 100% rename from tests/writer/Readme.md rename to tests/writer/mysql/Readme.md diff --git a/tests/writer/src/main.rs b/tests/writer/mysql/src/main.rs similarity index 100% rename from tests/writer/src/main.rs rename to tests/writer/mysql/src/main.rs From 71af023cd4510c6c5d7dfb9fe96a7404a94e6d53 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Thu, 29 Jul 2021 23:02:30 +0800 Subject: [PATCH 07/21] WIP --- Cargo.toml | 1 + src/postgres/writer/column.rs | 0 src/postgres/writer/constraints.rs | 0 src/postgres/writer/mod.rs | 23 +++++++++++++++++++++++ src/postgres/writer/schema.rs | 0 src/postgres/writer/table.rs | 22 ++++++++++++++++++++++ src/postgres/writer/types.rs | 0 tests/writer/postgres/Cargo.toml | 12 ++++++++++++ tests/writer/postgres/Readme.md | 5 +++++ tests/writer/postgres/src/main.rs | 19 +++++++++++++++++++ 10 files changed, 82 insertions(+) create mode 100644 src/postgres/writer/column.rs create mode 100644 src/postgres/writer/constraints.rs create mode 100644 src/postgres/writer/schema.rs create mode 100644 src/postgres/writer/table.rs create mode 100644 src/postgres/writer/types.rs create mode 100644 tests/writer/postgres/Cargo.toml create mode 100644 tests/writer/postgres/Readme.md create mode 100644 tests/writer/postgres/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 31b06300..8f395aa5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ members = [ "tests/discovery/mysql", "tests/discovery/postgres", "tests/writer/mysql", + "tests/writer/postgres", ] [package] diff --git a/src/postgres/writer/column.rs b/src/postgres/writer/column.rs new file mode 100644 index 00000000..e69de29b diff --git a/src/postgres/writer/constraints.rs b/src/postgres/writer/constraints.rs new file mode 100644 index 00000000..e69de29b diff --git a/src/postgres/writer/mod.rs b/src/postgres/writer/mod.rs index 8b137891..818d9dfc 100644 --- a/src/postgres/writer/mod.rs +++ b/src/postgres/writer/mod.rs @@ -1 +1,24 @@ +mod column; +mod constraints; +mod schema; +mod table; +mod types; +pub use column::*; +pub use constraints::*; +pub use schema::*; +pub use table::*; +pub use types::*; + +use super::def::Schema; +use sea_query::SchemaStatement; + +impl Schema { + pub fn write(&self) -> Vec { + let mut statements = Vec::new(); + for table in self.tables.iter() { + statements.push(SchemaStatement::TableStatement(table.write())); + } + statements + } +} diff --git a/src/postgres/writer/schema.rs b/src/postgres/writer/schema.rs new file mode 100644 index 00000000..e69de29b diff --git a/src/postgres/writer/table.rs b/src/postgres/writer/table.rs new file mode 100644 index 00000000..f7719637 --- /dev/null +++ b/src/postgres/writer/table.rs @@ -0,0 +1,22 @@ +use crate::postgres::def::TableDef; +use sea_query::{Alias, Iden, Table, TableStatement}; + +impl TableDef { + pub fn write(&self) -> TableStatement { + let mut table = Table::create(); + // table.table(Alias::new(self.info.name.as_ref())); + // for col in self.columns.iter() { + // table.col(col.write()); + // } + // table.engine(self.info.engine.to_string().as_str()); + // table.character_set(self.info.char_set.to_string().as_str()); + // table.collate(self.info.collation.to_string().as_str()); + // for idx in self.indexes.iter() { + // table.index(idx.write()); + // } + // for key in self.foreign_keys.iter() { + // table.foreign_key(key.write()); + // } + TableStatement::Create(table) + } +} \ No newline at end of file diff --git a/src/postgres/writer/types.rs b/src/postgres/writer/types.rs new file mode 100644 index 00000000..e69de29b diff --git a/tests/writer/postgres/Cargo.toml b/tests/writer/postgres/Cargo.toml new file mode 100644 index 00000000..c9a14b26 --- /dev/null +++ b/tests/writer/postgres/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "sea-schema-writer-test-postgres" +version = "0.1.0" +edition = "2018" +publish = false + +[dependencies] +async-std = { version = "1.8", features = [ "attributes" ] } +sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "writer" ] } +sea-query = { version = "^0.12" } +serde_json = { version = "^1" } +sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/writer/postgres/Readme.md b/tests/writer/postgres/Readme.md new file mode 100644 index 00000000..6946a346 --- /dev/null +++ b/tests/writer/postgres/Readme.md @@ -0,0 +1,5 @@ +# Run + +```sh +cargo run > schema.sql +``` \ No newline at end of file diff --git a/tests/writer/postgres/src/main.rs b/tests/writer/postgres/src/main.rs new file mode 100644 index 00000000..87d216a8 --- /dev/null +++ b/tests/writer/postgres/src/main.rs @@ -0,0 +1,19 @@ +use sea_query::PostgresQueryBuilder; +use sea_schema::postgres::discovery::SchemaDiscovery; +use sqlx::PgPool; + +#[async_std::main] +async fn main() { + let connection = PgPool::connect("postgres://sea:sea@localhost/sakila") + .await + .unwrap(); + + let schema_discovery = SchemaDiscovery::new(connection, "public"); + + let schema = schema_discovery.discover().await; + + for table in schema.tables.iter() { + println!("{};", table.write().to_string(PostgresQueryBuilder)); + println!(); + } +} From d44aa5fb24de0e87c657fb987e85b23ee30fe1be Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Fri, 30 Jul 2021 23:25:49 +0800 Subject: [PATCH 08/21] WIP --- src/postgres/def/column.rs | 7 +- src/postgres/writer/column.rs | 116 +++++++++++++++++++++++++++++ src/postgres/writer/constraints.rs | 1 + src/postgres/writer/schema.rs | 1 + src/postgres/writer/table.rs | 10 +-- src/postgres/writer/types.rs | 1 + 6 files changed, 127 insertions(+), 9 deletions(-) diff --git a/src/postgres/def/column.rs b/src/postgres/def/column.rs index ee4dc1aa..bf14c59f 100644 --- a/src/postgres/def/column.rs +++ b/src/postgres/def/column.rs @@ -1,8 +1,7 @@ #[cfg(feature = "with-serde")] use serde::{Deserialize, Serialize}; -use super::constraints; -use super::Type; +use super::{NotNull, Type}; #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] @@ -16,7 +15,7 @@ pub struct ColumnInfo { pub default: Option, /// The generation expression for this column, if it is a generated colum pub generated: Option, - pub not_null: Option, + pub not_null: Option, // TODO: // /// A constraint that ensures the value of a column is unique among all other rows in the table // pub unique: Option>, @@ -36,7 +35,7 @@ pub type ColumnType = Type; #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] -pub struct ColumnExpression(String); +pub struct ColumnExpression(pub String); impl ColumnExpression { pub fn from_option_string(maybe_string: Option) -> Option { diff --git a/src/postgres/writer/column.rs b/src/postgres/writer/column.rs index e69de29b..be6c1e8b 100644 --- a/src/postgres/writer/column.rs +++ b/src/postgres/writer/column.rs @@ -0,0 +1,116 @@ +use crate::postgres::def::{ArbitraryPrecisionNumericAttr, ColumnInfo, Type}; +use core::num; +use sea_query::{escape_string, Alias, ColumnDef, Iden}; +use std::fmt::Write; + +impl ColumnInfo { + pub fn write(&self) -> ColumnDef { + let mut col_def = ColumnDef::new(Alias::new(self.name.as_str())); + col_def = self.write_col_type(col_def); + if !self.not_null.is_some() { + col_def = col_def.not_null(); + } + // if self.extra.auto_increment { + // col_def = col_def.auto_increment(); + // } + let mut extras = Vec::new(); + if let Some(default) = self.default.as_ref() { + let mut string = "".to_owned(); + write!(&mut string, "DEFAULT {}", default.0).unwrap(); + extras.push(string); + } + // if self.extra.on_update_current_timestamp { + // extras.push("ON UPDATE CURRENT_TIMESTAMP".to_owned()); + // } + // if !self.comment.is_empty() { + // let mut string = "".to_owned(); + // write!(&mut string, "COMMENT '{}'", escape_string(&self.comment)).unwrap(); + // extras.push(string); + // } + if !extras.is_empty() { + col_def = col_def.extra(extras.join(" ")); + } + col_def + } + + pub fn write_col_type(&self, mut col_def: ColumnDef) -> ColumnDef { + match &self.col_type { + Type::SmallInt => { + col_def = col_def.small_integer(); + } + Type::Integer => { + col_def = col_def.integer(); + } + Type::BigInt => { + col_def = col_def.big_integer(); + } + Type::Decimal(num_attr) => { + if num_attr.precision.is_none() & num_attr.scale.is_none() { + col_def = col_def.decimal(); + } else { + col_def = col_def.decimal_len( + num_attr.precision.unwrap_or(0) as u32, + num_attr.scale.unwrap_or(0) as u32, + ); + } + } + Type::Numeric(num_attr) => {} + Type::Real => { + col_def = col_def.float(); + } + Type::DoublePrecision => { + col_def = col_def.double(); + } + Type::SmallSerial => { + col_def = col_def.small_integer().auto_increment(); + } + Type::Serial => { + col_def = col_def.integer().auto_increment(); + } + Type::BigSerial => { + col_def = col_def.big_integer().auto_increment(); + } + Type::Money => { + col_def = col_def.money(); + } + Type::Varchar => {} + Type::Char => {} + Type::Text => {} + Type::Bytea => {} + Type::Timestamp => {} + Type::Date => {} + Type::Time => {} + Type::Interval => {} + Type::Boolean => {} + Type::Point => {} + Type::Line => {} + Type::Lseg => {} + Type::Box => {} + Type::Path => {} + Type::Polygon => {} + Type::Circle => {} + Type::Cidr => {} + Type::Inet => {} + Type::MacAddr => {} + Type::MacAddr8 => {} + Type::Bit => {} + Type::TsVector => {} + Type::TsQuery => {} + Type::Uuid => {} + Type::Xml => {} + Type::Json => {} + Type::Array => {} + Type::Int4Range => {} + Type::Int8Range => {} + Type::NumRange => {} + Type::TsRange => {} + Type::TsTzRange => {} + Type::DateRange => {} + Type::PgLsn => {} + Type::Unknown(s) => { + col_def = col_def.custom(Alias::new(s)); + } + }; + col_def + } +} diff --git a/src/postgres/writer/constraints.rs b/src/postgres/writer/constraints.rs index e69de29b..8b137891 100644 --- a/src/postgres/writer/constraints.rs +++ b/src/postgres/writer/constraints.rs @@ -0,0 +1 @@ + diff --git a/src/postgres/writer/schema.rs b/src/postgres/writer/schema.rs index e69de29b..8b137891 100644 --- a/src/postgres/writer/schema.rs +++ b/src/postgres/writer/schema.rs @@ -0,0 +1 @@ + diff --git a/src/postgres/writer/table.rs b/src/postgres/writer/table.rs index f7719637..0bb94233 100644 --- a/src/postgres/writer/table.rs +++ b/src/postgres/writer/table.rs @@ -4,10 +4,10 @@ use sea_query::{Alias, Iden, Table, TableStatement}; impl TableDef { pub fn write(&self) -> TableStatement { let mut table = Table::create(); - // table.table(Alias::new(self.info.name.as_ref())); - // for col in self.columns.iter() { - // table.col(col.write()); - // } + table.table(Alias::new(self.info.name.as_ref())); + for col in self.columns.iter() { + table.col(col.write()); + } // table.engine(self.info.engine.to_string().as_str()); // table.character_set(self.info.char_set.to_string().as_str()); // table.collate(self.info.collation.to_string().as_str()); @@ -19,4 +19,4 @@ impl TableDef { // } TableStatement::Create(table) } -} \ No newline at end of file +} diff --git a/src/postgres/writer/types.rs b/src/postgres/writer/types.rs index e69de29b..8b137891 100644 --- a/src/postgres/writer/types.rs +++ b/src/postgres/writer/types.rs @@ -0,0 +1 @@ + From 4a3aed9c9e0e70a4245d68f449bbdf71c9b1a943 Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sun, 1 Aug 2021 17:48:57 +0800 Subject: [PATCH 09/21] Postgres sakila --- tests/discovery/postgres/schema.rs | 3123 ++++++++++++++++++++++++++++ 1 file changed, 3123 insertions(+) create mode 100644 tests/discovery/postgres/schema.rs diff --git a/tests/discovery/postgres/schema.rs b/tests/discovery/postgres/schema.rs new file mode 100644 index 00000000..23968998 --- /dev/null +++ b/tests/discovery/postgres/schema.rs @@ -0,0 +1,3123 @@ +SELECT "table_name", "user_defined_type_schema", "user_defined_type_name" FROM "information_schema"."tables" WHERE "table_schema" = $1 AND "table_type" = $2, Values([String("public"), String("BASE TABLE")]) + +TableQueryResult { table_name: "actor", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "actor", of_type: None } +TableQueryResult { table_name: "film", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "film", of_type: None } +TableQueryResult { table_name: "payment_p2007_02", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "payment_p2007_02", of_type: None } +TableQueryResult { table_name: "payment_p2007_03", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "payment_p2007_03", of_type: None } +TableQueryResult { table_name: "payment_p2007_04", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "payment_p2007_04", of_type: None } +TableQueryResult { table_name: "payment_p2007_05", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "payment_p2007_05", of_type: None } +TableQueryResult { table_name: "payment_p2007_06", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "payment_p2007_06", of_type: None } +TableQueryResult { table_name: "payment_p2007_01", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "payment_p2007_01", of_type: None } +TableQueryResult { table_name: "address", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "address", of_type: None } +TableQueryResult { table_name: "category", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "category", of_type: None } +TableQueryResult { table_name: "city", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "city", of_type: None } +TableQueryResult { table_name: "country", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "country", of_type: None } +TableQueryResult { table_name: "customer", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "customer", of_type: None } +TableQueryResult { table_name: "film_actor", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "film_actor", of_type: None } +TableQueryResult { table_name: "film_category", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "film_category", of_type: None } +TableQueryResult { table_name: "inventory", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "inventory", of_type: None } +TableQueryResult { table_name: "language", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "language", of_type: None } +TableQueryResult { table_name: "rental", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "rental", of_type: None } +TableQueryResult { table_name: "staff", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "staff", of_type: None } +TableQueryResult { table_name: "store", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "store", of_type: None } +TableQueryResult { table_name: "payment", user_defined_type_schema: None, user_defined_type_name: None } +TableInfo { name: "payment", of_type: None } + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("actor")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("film")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_02")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_03")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_04")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_05")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_06")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_01")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("address")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("category")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("city")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("country")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("customer")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("film_actor")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("film_category")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("inventory")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("language")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("rental")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("staff")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("store")]) + +SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment")]) + +ColumnQueryResult { column_name: "category_id", column_type: "integer", column_default: Some("nextval(\'category_category_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "category_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'category_category_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("category")]) + +ColumnQueryResult { column_name: "film_id", column_type: "integer", column_default: Some("nextval(\'film_film_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "film_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'film_film_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "title", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "title", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "description", column_type: "text", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "description", col_type: Unknown("text is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "release_year", column_type: "integer", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "release_year", col_type: Integer, default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "language_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "language_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "original_language_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "original_language_id", col_type: SmallInt, default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "rental_duration", column_type: "smallint", column_default: Some("3"), column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_duration", col_type: SmallInt, default: Some(ColumnExpression("3")), generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_rate", column_type: "numeric", column_default: Some("4.99"), column_generated: None, is_nullable: "NO", numeric_precision: Some(4), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "rental_rate", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(4), scale: Some(2) }), default: Some(ColumnExpression("4.99")), generated: None, not_null: None } +ColumnQueryResult { column_name: "length", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "length", col_type: SmallInt, default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "replacement_cost", column_type: "numeric", column_default: Some("19.99"), column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "replacement_cost", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: Some(ColumnExpression("19.99")), generated: None, not_null: None } +ColumnQueryResult { column_name: "rating", column_type: "USER-DEFINED", column_default: Some("\'G\'::mpaa_rating"), column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "rating", col_type: Unknown("USER is unknown or unimplemented"), default: Some(ColumnExpression("\'G\'::mpaa_rating")), generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } +ColumnQueryResult { column_name: "special_features", column_type: "ARRAY", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "special_features", col_type: Unknown("ARRAY is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "fulltext", column_type: "tsvector", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "fulltext", col_type: Unknown("tsvector is unknown or unimplemented"), default: None, generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("film")]) + +ColumnQueryResult { column_name: "city_id", column_type: "integer", column_default: Some("nextval(\'city_city_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "city_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'city_city_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "city", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "city", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "country_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "country_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("city")]) + +ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_03")]) + +ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_04")]) + +ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_06")]) + +ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_01")]) + +ColumnQueryResult { column_name: "address_id", column_type: "integer", column_default: Some("nextval(\'address_address_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "address_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'address_address_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "address", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "address", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "address2", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "address2", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "district", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "district", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "city_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "city_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "postal_code", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "postal_code", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "phone", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "phone", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("address")]) + +ColumnQueryResult { column_name: "country_id", column_type: "integer", column_default: Some("nextval(\'country_country_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "country_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'country_country_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "country", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "country", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("country")]) + +ColumnQueryResult { column_name: "actor_id", column_type: "integer", column_default: Some("nextval(\'actor_actor_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "actor_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'actor_actor_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "first_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "first_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("actor")]) + +ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_02")]) + +ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_05")]) + +ColumnQueryResult { column_name: "actor_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "actor_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "film_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "film_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("film_actor")]) + +ColumnQueryResult { column_name: "film_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "film_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "category_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "category_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("film_category")]) + +ColumnQueryResult { column_name: "inventory_id", column_type: "integer", column_default: Some("nextval(\'inventory_inventory_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "inventory_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'inventory_inventory_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "film_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "film_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "store_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "store_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("inventory")]) + +ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: Some("nextval(\'rental_rental_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'rental_rental_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "rental_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "inventory_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "inventory_id", col_type: Integer, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "return_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "return_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("rental")]) + +ColumnQueryResult { column_name: "staff_id", column_type: "integer", column_default: Some("nextval(\'staff_staff_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'staff_staff_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "first_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "first_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "address_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "address_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "email", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "email", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "store_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "store_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "active", column_type: "boolean", column_default: Some("true"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "active", col_type: Unknown("boolean is unknown or unimplemented"), default: Some(ColumnExpression("true")), generated: None, not_null: None } +ColumnQueryResult { column_name: "username", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "username", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "password", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "password", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } +ColumnQueryResult { column_name: "picture", column_type: "bytea", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "picture", col_type: Unknown("bytea is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("staff")]) + +ColumnQueryResult { column_name: "customer_id", column_type: "integer", column_default: Some("nextval(\'customer_customer_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'customer_customer_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "store_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "store_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "first_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "first_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "email", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "email", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "address_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "address_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "activebool", column_type: "boolean", column_default: Some("true"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "activebool", col_type: Unknown("boolean is unknown or unimplemented"), default: Some(ColumnExpression("true")), generated: None, not_null: None } +ColumnQueryResult { column_name: "create_date", column_type: "date", column_default: Some("(\'now\'::text)::date"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "create_date", col_type: Unknown("date is unknown or unimplemented"), default: Some(ColumnExpression("(\'now\'::text)::date")), generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: Some(NotNull) } +ColumnQueryResult { column_name: "active", column_type: "integer", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "active", col_type: Integer, default: None, generated: None, not_null: Some(NotNull) } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("customer")]) + +ColumnQueryResult { column_name: "language_id", column_type: "integer", column_default: Some("nextval(\'language_language_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "language_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'language_language_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "name", column_type: "character", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("language")]) + +ColumnQueryResult { column_name: "store_id", column_type: "integer", column_default: Some("nextval(\'store_store_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "store_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'store_store_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "manager_staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "manager_staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "address_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "address_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("store")]) + +ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } +ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } +ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } +ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } +ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } +ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } + +SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment")]) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_10_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("replacement_cost IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_12_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_14_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("fulltext IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_1_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("film_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_2_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("title IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_5_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("language_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_7_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_duration IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_8_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_rate IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_language_id_fkey", table_schema: "public", table_name: "film", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("language_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("language_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("language"), referential_key_column_name: Some("language_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_original_language_id_fkey", table_schema: "public", table_name: "film", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("original_language_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("language_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("language"), referential_key_column_name: Some("language_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_pkey", table_schema: "public", table_name: "film", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "replacement_cost IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +Check(Check { expr: "fulltext IS NOT NULL", no_inherit: false }) +Check(Check { expr: "film_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "title IS NOT NULL", no_inherit: false }) +Check(Check { expr: "language_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_duration IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_rate IS NOT NULL", no_inherit: false }) +References(References { columns: ["language_id"], table: "language", foreign_columns: ["language_id"] }) +References(References { columns: ["original_language_id"], table: "language", foreign_columns: ["language_id"] }) +PrimaryKey(PrimaryKey(["film_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_1_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_2_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_3_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_4_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_5_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_6_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_04_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_04_payment_date_check", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-04-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-05-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_04_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_04_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } + +Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) +Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) +References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) +Check(Check { expr: "(((payment_date >= \'2007-04-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-05-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) +References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) +References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25004_1_not_null", table_schema: "public", table_name: "category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("category_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25004_2_not_null", table_schema: "public", table_name: "category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25004_3_not_null", table_schema: "public", table_name: "category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "category_pkey", table_schema: "public", table_name: "category", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("category_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "category_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "name IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +PrimaryKey(PrimaryKey(["category_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_1_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_2_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_3_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_4_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_5_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_6_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_02_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_02_payment_date_check", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-02-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-03-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_02_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_02_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } + +Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) +Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) +References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) +Check(Check { expr: "(((payment_date >= \'2007-02-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-03-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) +References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) +References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_1_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_2_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_3_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_4_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_5_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_6_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_05_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_05_payment_date_check", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-05-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-06-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_05_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_05_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } + +Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) +Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) +References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) +Check(Check { expr: "(((payment_date >= \'2007-05-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-06-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) +References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) +References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_1_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_2_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_3_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_4_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_5_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_6_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_01_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_01_payment_date_check", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-01-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-02-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_01_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_01_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } + +Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) +Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) +References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) +Check(Check { expr: "(((payment_date >= \'2007-01-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-02-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) +References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) +References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_24980_1_not_null", table_schema: "public", table_name: "actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("actor_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_24980_2_not_null", table_schema: "public", table_name: "actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("first_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_24980_3_not_null", table_schema: "public", table_name: "actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_24980_4_not_null", table_schema: "public", table_name: "actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "actor_pkey", table_schema: "public", table_name: "actor", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("actor_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "actor_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "first_name IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_name IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +PrimaryKey(PrimaryKey(["actor_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_1_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_2_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_4_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("district IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_5_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("city_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_7_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("phone IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_8_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "address_city_id_fkey", table_schema: "public", table_name: "address", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("city_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("city_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("city"), referential_key_column_name: Some("city_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "address_pkey", table_schema: "public", table_name: "address", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("address_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "address_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "address IS NOT NULL", no_inherit: false }) +Check(Check { expr: "district IS NOT NULL", no_inherit: false }) +Check(Check { expr: "city_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "phone IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +References(References { columns: ["city_id"], table: "city", foreign_columns: ["city_id"] }) +PrimaryKey(PrimaryKey(["address_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_1_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_2_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_3_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_4_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_5_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_6_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_03_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_03_payment_date_check", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-03-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-04-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_03_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_03_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } + +Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) +Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) +References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) +Check(Check { expr: "(((payment_date >= \'2007-03-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-04-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) +References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) +References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25052_1_not_null", table_schema: "public", table_name: "country", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("country_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25052_2_not_null", table_schema: "public", table_name: "country", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("country IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25052_3_not_null", table_schema: "public", table_name: "country", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "country_pkey", table_schema: "public", table_name: "country", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("country_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "country_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "country IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +PrimaryKey(PrimaryKey(["country_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_1_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_2_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_3_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_4_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_5_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_6_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_06_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_06_payment_date_check", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-06-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-07-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_06_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_06_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } + +Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) +Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) +References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) +Check(Check { expr: "(((payment_date >= \'2007-06-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-07-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) +References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) +References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25045_1_not_null", table_schema: "public", table_name: "city", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("city_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25045_2_not_null", table_schema: "public", table_name: "city", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("city IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25045_3_not_null", table_schema: "public", table_name: "city", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("country_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25045_4_not_null", table_schema: "public", table_name: "city", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "city_country_id_fkey", table_schema: "public", table_name: "city", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("country_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("country_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("country"), referential_key_column_name: Some("country_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "city_pkey", table_schema: "public", table_name: "city", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("city_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "city_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "city IS NOT NULL", no_inherit: false }) +Check(Check { expr: "country_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +References(References { columns: ["country_id"], table: "country", foreign_columns: ["country_id"] }) +PrimaryKey(PrimaryKey(["city_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25023_1_not_null", table_schema: "public", table_name: "film_actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("actor_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25023_2_not_null", table_schema: "public", table_name: "film_actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("film_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25023_3_not_null", table_schema: "public", table_name: "film_actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_actor_actor_id_fkey", table_schema: "public", table_name: "film_actor", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("actor_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("actor_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("actor"), referential_key_column_name: Some("actor_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_actor_film_id_fkey", table_schema: "public", table_name: "film_actor", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("film_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("film"), referential_key_column_name: Some("film_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_actor_pkey", table_schema: "public", table_name: "film_actor", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("actor_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_actor_pkey", table_schema: "public", table_name: "film_actor", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(2), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "actor_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "film_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +References(References { columns: ["actor_id"], table: "actor", foreign_columns: ["actor_id"] }) +References(References { columns: ["film_id"], table: "film", foreign_columns: ["film_id"] }) +PrimaryKey(PrimaryKey(["actor_id", "film_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25078_1_not_null", table_schema: "public", table_name: "inventory", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("inventory_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25078_2_not_null", table_schema: "public", table_name: "inventory", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("film_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25078_3_not_null", table_schema: "public", table_name: "inventory", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("store_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25078_4_not_null", table_schema: "public", table_name: "inventory", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "inventory_film_id_fkey", table_schema: "public", table_name: "inventory", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("film_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("film"), referential_key_column_name: Some("film_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "inventory_pkey", table_schema: "public", table_name: "inventory", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("inventory_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "inventory_store_id_fkey", table_schema: "public", table_name: "inventory", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("store_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("store_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("store"), referential_key_column_name: Some("store_id") } + +Check(Check { expr: "inventory_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "film_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "store_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +References(References { columns: ["film_id"], table: "film", foreign_columns: ["film_id"] }) +PrimaryKey(PrimaryKey(["inventory_id"])) +References(References { columns: ["store_id"], table: "store", foreign_columns: ["store_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25027_1_not_null", table_schema: "public", table_name: "film_category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("film_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25027_2_not_null", table_schema: "public", table_name: "film_category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("category_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25027_3_not_null", table_schema: "public", table_name: "film_category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_category_category_id_fkey", table_schema: "public", table_name: "film_category", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("category_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("category_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("category"), referential_key_column_name: Some("category_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_category_film_id_fkey", table_schema: "public", table_name: "film_category", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("film_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("film"), referential_key_column_name: Some("film_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_category_pkey", table_schema: "public", table_name: "film_category", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_category_pkey", table_schema: "public", table_name: "film_category", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("category_id"), ordinal_position: Some(2), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "film_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "category_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +References(References { columns: ["category_id"], table: "category", foreign_columns: ["category_id"] }) +References(References { columns: ["film_id"], table: "film", foreign_columns: ["film_id"] }) +PrimaryKey(PrimaryKey(["film_id", "category_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_1_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_2_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_3_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("inventory_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_4_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_6_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_7_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "rental_customer_id_fkey", table_schema: "public", table_name: "rental", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "rental_inventory_id_fkey", table_schema: "public", table_name: "rental", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("inventory_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("inventory_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("inventory"), referential_key_column_name: Some("inventory_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "rental_pkey", table_schema: "public", table_name: "rental", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "rental_staff_id_fkey", table_schema: "public", table_name: "rental", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } + +Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_date IS NOT NULL", no_inherit: false }) +Check(Check { expr: "inventory_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) +References(References { columns: ["inventory_id"], table: "inventory", foreign_columns: ["inventory_id"] }) +PrimaryKey(PrimaryKey(["rental_id"])) +References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_10_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_1_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_2_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("first_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_3_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_4_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_6_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("store_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_7_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("active IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_8_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("username IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "staff_address_id_fkey", table_schema: "public", table_name: "staff", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("address_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("address_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("address"), referential_key_column_name: Some("address_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "staff_pkey", table_schema: "public", table_name: "staff", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "staff_store_id_fkey", table_schema: "public", table_name: "staff", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("store_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("store_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("store"), referential_key_column_name: Some("store_id") } + +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "first_name IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_name IS NOT NULL", no_inherit: false }) +Check(Check { expr: "address_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "store_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "active IS NOT NULL", no_inherit: false }) +Check(Check { expr: "username IS NOT NULL", no_inherit: false }) +References(References { columns: ["address_id"], table: "address", foreign_columns: ["address_id"] }) +PrimaryKey(PrimaryKey(["staff_id"])) +References(References { columns: ["store_id"], table: "store", foreign_columns: ["store_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_1_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_2_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("store_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_3_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("first_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_4_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_6_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_7_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("activebool IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_8_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("create_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "customer_address_id_fkey", table_schema: "public", table_name: "customer", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("address_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("address_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("address"), referential_key_column_name: Some("address_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "customer_pkey", table_schema: "public", table_name: "customer", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "customer_store_id_fkey", table_schema: "public", table_name: "customer", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("store_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("store_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("store"), referential_key_column_name: Some("store_id") } + +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "store_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "first_name IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_name IS NOT NULL", no_inherit: false }) +Check(Check { expr: "address_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "activebool IS NOT NULL", no_inherit: false }) +Check(Check { expr: "create_date IS NOT NULL", no_inherit: false }) +References(References { columns: ["address_id"], table: "address", foreign_columns: ["address_id"] }) +PrimaryKey(PrimaryKey(["customer_id"])) +References(References { columns: ["store_id"], table: "store", foreign_columns: ["store_id"] }) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25085_1_not_null", table_schema: "public", table_name: "language", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("language_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25085_2_not_null", table_schema: "public", table_name: "language", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25085_3_not_null", table_schema: "public", table_name: "language", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "language_pkey", table_schema: "public", table_name: "language", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("language_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "language_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "name IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +PrimaryKey(PrimaryKey(["language_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25156_1_not_null", table_schema: "public", table_name: "store", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("store_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25156_2_not_null", table_schema: "public", table_name: "store", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("manager_staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25156_3_not_null", table_schema: "public", table_name: "store", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25156_4_not_null", table_schema: "public", table_name: "store", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "store_address_id_fkey", table_schema: "public", table_name: "store", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("address_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("address_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("address"), referential_key_column_name: Some("address_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "store_manager_staff_id_fkey", table_schema: "public", table_name: "store", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("manager_staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "store_pkey", table_schema: "public", table_name: "store", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("store_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } + +Check(Check { expr: "store_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "manager_staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "address_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) +References(References { columns: ["address_id"], table: "address", foreign_columns: ["address_id"] }) +References(References { columns: ["manager_staff_id"], table: "staff", foreign_columns: ["staff_id"] }) +PrimaryKey(PrimaryKey(["store_id"])) + +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_1_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_2_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_3_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_4_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_5_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_6_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_customer_id_fkey", table_schema: "public", table_name: "payment", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_pkey", table_schema: "public", table_name: "payment", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("payment_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_rental_id_fkey", table_schema: "public", table_name: "payment", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("SET NULL"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } +TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_staff_id_fkey", table_schema: "public", table_name: "payment", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } + +Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) +Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) +Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) +References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) +PrimaryKey(PrimaryKey(["payment_id"])) +References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) +References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) + +Schema { + schema: "public", + tables: [ + TableDef { + info: TableInfo { + name: "actor", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "actor_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'actor_actor_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "first_name", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_name", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "actor_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "first_name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "film", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "film_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'film_film_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "title", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "description", + col_type: Unknown( + "text is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "release_year", + col_type: Integer, + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "language_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "original_language_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "rental_duration", + col_type: SmallInt, + default: Some( + ColumnExpression( + "3", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_rate", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 4, + ), + scale: Some( + 2, + ), + }, + ), + default: Some( + ColumnExpression( + "4.99", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "length", + col_type: SmallInt, + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "replacement_cost", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: Some( + ColumnExpression( + "19.99", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rating", + col_type: Unknown( + "USER is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "\'G\'::mpaa_rating", + ), + ), + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "special_features", + col_type: Unknown( + "ARRAY is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "fulltext", + col_type: Unknown( + "tsvector is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "replacement_cost IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "fulltext IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "film_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "title IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "language_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_duration IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_rate IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "language_id", + ], + table: "language", + foreign_columns: [ + "language_id", + ], + }, + References { + columns: [ + "original_language_id", + ], + table: "language", + foreign_columns: [ + "language_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "payment_p2007_02", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "payment_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'payment_payment_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "payment_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "payment_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= \'2007-02-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-03-01 00:00:00\'::timestamp without time zone)))", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "payment_p2007_03", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "payment_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'payment_payment_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "payment_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "payment_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= \'2007-03-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-04-01 00:00:00\'::timestamp without time zone)))", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "payment_p2007_04", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "payment_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'payment_payment_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "payment_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "payment_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= \'2007-04-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-05-01 00:00:00\'::timestamp without time zone)))", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "payment_p2007_05", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "payment_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'payment_payment_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "payment_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "payment_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= \'2007-05-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-06-01 00:00:00\'::timestamp without time zone)))", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "payment_p2007_06", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "payment_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'payment_payment_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "payment_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "payment_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= \'2007-06-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-07-01 00:00:00\'::timestamp without time zone)))", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "payment_p2007_01", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "payment_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'payment_payment_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "payment_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "payment_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= \'2007-01-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-02-01 00:00:00\'::timestamp without time zone)))", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "address", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "address_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'address_address_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "address", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "address2", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "district", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "city_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "postal_code", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "phone", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "address_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "address IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "district IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "city_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "phone IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "city_id", + ], + table: "city", + foreign_columns: [ + "city_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "category", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "category_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'category_category_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "name", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "category_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "city", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "city_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'city_city_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "city", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "country_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "city_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "city IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "country_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "country_id", + ], + table: "country", + foreign_columns: [ + "country_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "country", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "country_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'country_country_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "country", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "country_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "country IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "customer", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "customer_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'customer_customer_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "store_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "first_name", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_name", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "email", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "address_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "activebool", + col_type: Unknown( + "boolean is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "true", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "create_date", + col_type: Unknown( + "date is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "(\'now\'::text)::date", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "active", + col_type: Integer, + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ], + check_constraints: [ + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "store_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "first_name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "address_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "activebool IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "create_date IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "address_id", + ], + table: "address", + foreign_columns: [ + "address_id", + ], + }, + References { + columns: [ + "store_id", + ], + table: "store", + foreign_columns: [ + "store_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "film_actor", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "actor_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "film_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "actor_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "film_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "actor_id", + ], + table: "actor", + foreign_columns: [ + "actor_id", + ], + }, + References { + columns: [ + "film_id", + ], + table: "film", + foreign_columns: [ + "film_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "film_category", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "film_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "category_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "film_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "category_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "category_id", + ], + table: "category", + foreign_columns: [ + "category_id", + ], + }, + References { + columns: [ + "film_id", + ], + table: "film", + foreign_columns: [ + "film_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "inventory", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "inventory_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'inventory_inventory_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "film_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "store_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "inventory_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "film_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "store_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "film_id", + ], + table: "film", + foreign_columns: [ + "film_id", + ], + }, + References { + columns: [ + "store_id", + ], + table: "store", + foreign_columns: [ + "store_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "language", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "language_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'language_language_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "name", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "language_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "rental", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'rental_rental_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "inventory_id", + col_type: Integer, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "return_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "inventory_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "inventory_id", + ], + table: "inventory", + foreign_columns: [ + "inventory_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "staff", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "staff_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'staff_staff_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "first_name", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_name", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "address_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "email", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "store_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "active", + col_type: Unknown( + "boolean is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "true", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "username", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "password", + col_type: Unknown( + "character is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "picture", + col_type: Unknown( + "bytea is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ], + check_constraints: [ + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "first_name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "address_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "store_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "active IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "username IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "address_id", + ], + table: "address", + foreign_columns: [ + "address_id", + ], + }, + References { + columns: [ + "store_id", + ], + table: "store", + foreign_columns: [ + "store_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "store", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "store_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'store_store_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "manager_staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "address_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "last_update", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "store_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "manager_staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "address_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "address_id", + ], + table: "address", + foreign_columns: [ + "address_id", + ], + }, + References { + columns: [ + "manager_staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "payment", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "payment_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval(\'payment_payment_id_seq\'::regclass)", + ), + ), + generated: None, + not_null: None, + }, + ColumnInfo { + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "payment_date", + col_type: Unknown( + "timestamp is unknown or unimplemented", + ), + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "payment_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + ], + unique_keys: [], + references: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + of_type: None, + }, + ], +} From e834af6ba131fae3e8a9d1ca861381479504e603 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Mon, 2 Aug 2021 18:40:42 +0800 Subject: [PATCH 10/21] Parse more column types --- src/postgres/def/schema.rs | 7 +- src/postgres/def/types.rs | 103 +- src/postgres/discovery/mod.rs | 33 +- src/postgres/parser/column.rs | 108 +- src/postgres/query/column.rs | 21 +- src/postgres/writer/column.rs | 16 +- tests/discovery/postgres/Cargo.toml | 2 +- tests/discovery/postgres/schema.rs | 3359 +++++++++++++-------------- tests/writer/postgres/Cargo.toml | 2 +- tests/writer/postgres/src/main.rs | 2 + 10 files changed, 1852 insertions(+), 1801 deletions(-) diff --git a/src/postgres/def/schema.rs b/src/postgres/def/schema.rs index 731316b1..c5e9ec09 100644 --- a/src/postgres/def/schema.rs +++ b/src/postgres/def/schema.rs @@ -17,8 +17,11 @@ pub struct TableDef { pub columns: Vec, pub check_constraints: Vec, - pub unique_keys: Vec, - pub references: Vec, + pub not_null_constraints: Vec, + pub unique_constraints: Vec, + pub primary_key_constraints: Vec, + pub reference_constraints: Vec, + pub exclusion_constraints: Vec, // FIXME: Duplication? TableInfo also have of_type pub of_type: Option, diff --git a/src/postgres/def/types.rs b/src/postgres/def/types.rs index f68f4578..ae5a0c04 100644 --- a/src/postgres/def/types.rs +++ b/src/postgres/def/types.rs @@ -33,9 +33,9 @@ pub enum Type { // Character types /// Variable-length character array with limit - Varchar, + Varchar(StringAttr), /// Fixed-length character array; blank padded - Char, + Char(StringAttr), /// Variable, unlimited length character array Text, @@ -44,13 +44,15 @@ pub enum Type { // Date/Time types /// Date and time - Timestamp, + Timestamp(TimeAttr), + TimestampWithTimeZone(TimeAttr), /// Date without time of day Date, /// Time without date - Time, + Time(TimeAttr), + TimeWithTimeZone(TimeAttr), /// Time interval - Interval, + Interval(IntervalAttr), /// One byte boolean value Boolean, @@ -86,7 +88,7 @@ pub enum Type { MacAddr8, /// Fixed length bit string - Bit, + Bit(BitAttr), // Text search types /// A sorted list of distincp lexemes which are words that have been normalized to merge different @@ -152,8 +154,48 @@ impl Type { "smallserial" | "serial2" => Type::SmallSerial, "serial" | "serial4" => Type::Serial, "bigserial" | "serial8" => Type::BigSerial, + "money" => Type::Money, + "character varying" | "varchar" => Type::Varchar(StringAttr::default()), + "character" | "char" => Type::Char(StringAttr::default()), + "text" => Type::Text, + "bytea" => Type::Bytea, + "timestamp" | "timestamp without time zone" => Type::Timestamp(TimeAttr::default()), + "timestamp with time zone" => Type::TimestampWithTimeZone(TimeAttr::default()), + "date" => Type::Date, + "time" | "time without time zone" => Type::Time(TimeAttr::default()), + "time with time zone" => Type::TimeWithTimeZone(TimeAttr::default()), + "interval" => Type::Interval(IntervalAttr::default()), + "boolean" => Type::Boolean, + // "" => Type::Enum, + "point" => Type::Point, + "line" => Type::Line, + "lseg" => Type::Lseg, + "box" => Type::Box, + "path" => Type::Path, + "polygon" => Type::Polygon, + "circle" => Type::Circle, + "cidr" => Type::Cidr, + "inet" => Type::Inet, + "macaddr" => Type::MacAddr, + "macaddr8" => Type::MacAddr8, + "bit" => Type::Bit(BitAttr::default()), + "tsvector" => Type::TsVector, + "tsquery" => Type::TsQuery, + "uuid" => Type::Uuid, + "xml" => Type::Xml, + "json" => Type::Json, + "array" => Type::Array, + // "" => Type::Composite, + "int4range" => Type::Int4Range, + "int8range" => Type::Int8Range, + "numrange" => Type::NumRange, + "tsrange" => Type::TsRange, + "tstzrange" => Type::TsTzRange, + "daterange" => Type::DateRange, + // "" => Type::Domain, + "pg_lsn" => Type::PgLsn, - _ => Type::Unknown(format!("{} is unknown or unimplemented", name)), + _ => Type::Unknown(name.to_owned()), } } } @@ -170,8 +212,55 @@ pub struct ArbitraryPrecisionNumericAttr { pub scale: Option, } +#[derive(Clone, Debug, PartialEq, Default)] +#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] +pub struct StringAttr { + pub length: Option, +} + +#[derive(Clone, Debug, PartialEq, Default)] +#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] +pub struct TimeAttr { + pub precision: Option, +} + +#[derive(Clone, Debug, PartialEq, Default)] +#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] +pub struct IntervalAttr { + pub field: Option, + pub precision: Option, +} + +#[derive(Clone, Debug, PartialEq, Default)] +#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] +pub struct BitAttr { + pub length: Option, +} + impl Type { pub fn has_numeric_attr(&self) -> bool { matches!(self, Type::Numeric(_) | Type::Decimal(_)) } + + pub fn has_string_attr(&self) -> bool { + matches!(self, Type::Varchar(_) | Type::Char(_)) + } + + pub fn has_time_attr(&self) -> bool { + matches!( + self, + Type::Timestamp(_) + | Type::TimestampWithTimeZone(_) + | Type::Time(_) + | Type::TimeWithTimeZone(_) + ) + } + + pub fn has_interval_attr(&self) -> bool { + matches!(self, Type::Interval(_)) + } + + pub fn has_bit_attr(&self) -> bool { + matches!(self, Type::Bit(_)) + } } diff --git a/src/postgres/discovery/mod.rs b/src/postgres/discovery/mod.rs index 927fdad3..9d4fc0df 100644 --- a/src/postgres/discovery/mod.rs +++ b/src/postgres/discovery/mod.rs @@ -82,14 +82,30 @@ impl SchemaDiscovery { let constraints = self .discover_constraints(self.schema.clone(), table.clone()) .await; - let (check_constraints, unique_keys, references) = constraints.into_iter().fold( - (Vec::new(), Vec::new(), Vec::new()), + let ( + check_constraints, + not_null_constraints, + unique_constraints, + primary_key_constraints, + reference_constraints, + exclusion_constraints, + ) = constraints.into_iter().fold( + ( + Vec::new(), + Vec::new(), + Vec::new(), + Vec::new(), + Vec::new(), + Vec::new(), + ), |mut acc, constraint| { match constraint { Constraint::Check(check) => acc.0.push(check), - Constraint::Unique(unique) => acc.1.push(unique), - Constraint::References(references) => acc.2.push(references), - _ => {} + Constraint::NotNull(not_null) => acc.1.push(not_null), + Constraint::Unique(unique) => acc.2.push(unique), + Constraint::PrimaryKey(primary_key) => acc.3.push(primary_key), + Constraint::References(references) => acc.4.push(references), + Constraint::Exclusion(exclusion) => acc.5.push(exclusion), } acc }, @@ -99,8 +115,11 @@ impl SchemaDiscovery { info, columns, check_constraints, - unique_keys, - references, + not_null_constraints, + unique_constraints, + primary_key_constraints, + reference_constraints, + exclusion_constraints, of_type: None, } } diff --git a/src/postgres/parser/column.rs b/src/postgres/parser/column.rs index f987237e..b57f39f0 100644 --- a/src/postgres/parser/column.rs +++ b/src/postgres/parser/column.rs @@ -8,7 +8,7 @@ use crate::{ Name, }; -use std::convert::TryFrom; +use std::convert::{TryFrom, TryInto}; impl ColumnQueryResult { pub fn parse(self) -> ColumnInfo { @@ -22,7 +22,7 @@ pub fn parse_column_query_result(result: ColumnQueryResult) -> ColumnInfo { col_type: parse_column_type(&result), default: ColumnExpression::from_option_string(result.column_default), generated: ColumnExpression::from_option_string(result.column_generated), - not_null: NotNull::from_bool(yes_or_no_to_bool(&result.is_nullable)), + not_null: NotNull::from_bool(!yes_or_no_to_bool(&result.is_nullable)), } } @@ -33,22 +33,34 @@ pub fn parse_column_type(result: &ColumnQueryResult) -> ColumnType { return Type::Unknown(String::default()); } - let ctype = if let Some(word) = parser_type.next_if_unquoted_any() { + let mut ctype = if let Some(word) = parser_type.next_if_unquoted_any() { Type::from_str(word.as_str()) } else { Type::from_str("") }; if ctype.has_numeric_attr() { - parse_numeric_attributes( + ctype = parse_numeric_attributes( result.numeric_precision, result.numeric_precision_radix, result.numeric_scale, ctype, - ) - } else { - ctype + ); + } + if ctype.has_string_attr() { + ctype = parse_string_attributes(result.character_maximum_length, ctype); + } + if ctype.has_time_attr() { + ctype = parse_time_attributes(result.datetime_precision, ctype); } + if ctype.has_interval_attr() { + ctype = parse_interval_attributes(&result.interval_type, result.interval_precision, ctype); + } + if ctype.has_bit_attr() { + ctype = parse_bit_attributes(result.character_maximum_length, ctype); + } + + ctype } pub fn parse_numeric_attributes( @@ -89,3 +101,85 @@ pub fn parse_numeric_attributes( ctype } + +pub fn parse_string_attributes( + character_maximum_length: Option, + mut ctype: ColumnType, +) -> ColumnType { + match ctype { + Type::Varchar(ref mut attr) | Type::Char(ref mut attr) => { + attr.length = match character_maximum_length { + None => None, + Some(num) => match u16::try_from(num) { + Ok(num) => Some(num), + Err(e) => None, + }, + }; + } + _ => panic!("parse_string_attributes(_) received a type that does not have StringAttr"), + }; + + ctype +} + +pub fn parse_time_attributes(datetime_precision: Option, mut ctype: ColumnType) -> ColumnType { + match ctype { + Type::Timestamp(ref mut attr) + | Type::TimestampWithTimeZone(ref mut attr) + | Type::Time(ref mut attr) + | Type::TimeWithTimeZone(ref mut attr) => { + attr.precision = match datetime_precision { + None => None, + Some(num) => match u16::try_from(num) { + Ok(num) => Some(num), + Err(e) => None, + }, + }; + } + _ => panic!("parse_time_attributes(_) received a type that does not have TimeAttr"), + }; + + ctype +} + +pub fn parse_interval_attributes( + interval_type: &Option, + interval_precision: Option, + mut ctype: ColumnType, +) -> ColumnType { + match ctype { + Type::Interval(ref mut attr) => { + attr.field = interval_type.clone(); + attr.precision = match interval_precision { + None => None, + Some(num) => match u16::try_from(num) { + Ok(num) => Some(num), + Err(e) => None, + }, + }; + } + _ => panic!("parse_interval_attributes(_) received a type that does not have IntervalAttr"), + }; + + ctype +} + +pub fn parse_bit_attributes( + character_maximum_length: Option, + mut ctype: ColumnType, +) -> ColumnType { + match ctype { + Type::Bit(ref mut attr) => { + attr.length = match character_maximum_length { + None => None, + Some(num) => match u16::try_from(num) { + Ok(num) => Some(num), + Err(e) => None, + }, + }; + } + _ => panic!("parse_bit_attributes(_) received a type that does not have BitAttr"), + }; + + ctype +} diff --git a/src/postgres/query/column.rs b/src/postgres/query/column.rs index dc9ae37e..3bba4f5a 100644 --- a/src/postgres/query/column.rs +++ b/src/postgres/query/column.rs @@ -14,13 +14,14 @@ pub enum ColumnsField { ColumnDefault, IsNullable, DataType, - CharacterMaximumlength, + CharacterMaximumLength, CharacterOctetLength, NumericPrecision, NumericPrecisionRadix, NumericScale, DatetimePrecision, IntervalType, + IntervalPrecision, CollationCatalog, CollationSchema, CollationName, @@ -55,6 +56,14 @@ pub struct ColumnQueryResult { pub numeric_precision: Option, pub numeric_precision_radix: Option, pub numeric_scale: Option, + + pub character_maximum_length: Option, + pub character_octet_length: Option, + + pub datetime_precision: Option, + + pub interval_type: Option, + pub interval_precision: Option, } impl SchemaQueryBuilder { @@ -69,6 +78,11 @@ impl SchemaQueryBuilder { ColumnsField::NumericPrecision, ColumnsField::NumericPrecisionRadix, ColumnsField::NumericScale, + ColumnsField::CharacterMaximumLength, + ColumnsField::CharacterOctetLength, + ColumnsField::DatetimePrecision, + ColumnsField::IntervalType, + ColumnsField::IntervalPrecision, ]) .from((InformationSchema::Schema, InformationSchema::Columns)) .and_where(Expr::col(ColumnsField::TableSchema).eq(schema.to_string())) @@ -89,6 +103,11 @@ impl From<&PgRow> for ColumnQueryResult { numeric_precision: row.get(5), numeric_precision_radix: row.get(6), numeric_scale: row.get(7), + character_maximum_length: row.get(8), + character_octet_length: row.get(9), + datetime_precision: row.get(10), + interval_type: row.get(11), + interval_precision: row.get(12), } } } diff --git a/src/postgres/writer/column.rs b/src/postgres/writer/column.rs index be6c1e8b..60f81aaa 100644 --- a/src/postgres/writer/column.rs +++ b/src/postgres/writer/column.rs @@ -7,7 +7,7 @@ impl ColumnInfo { pub fn write(&self) -> ColumnDef { let mut col_def = ColumnDef::new(Alias::new(self.name.as_str())); col_def = self.write_col_type(col_def); - if !self.not_null.is_some() { + if self.not_null.is_some() { col_def = col_def.not_null(); } // if self.extra.auto_increment { @@ -73,14 +73,16 @@ impl ColumnInfo { Type::Money => { col_def = col_def.money(); } - Type::Varchar => {} - Type::Char => {} + Type::Varchar(string_att) => {} + Type::Char(string_att) => {} Type::Text => {} Type::Bytea => {} - Type::Timestamp => {} + Type::Timestamp(time_att) => {} + Type::TimestampWithTimeZone(time_att) => {} Type::Date => {} - Type::Time => {} - Type::Interval => {} + Type::Time(time_att) => {} + Type::TimeWithTimeZone(time_att) => {} + Type::Interval(time_att) => {} Type::Boolean => {} Type::Point => {} Type::Line => {} @@ -93,7 +95,7 @@ impl ColumnInfo { Type::Inet => {} Type::MacAddr => {} Type::MacAddr8 => {} - Type::Bit => {} + Type::Bit(bit_attr) => {} Type::TsVector => {} Type::TsQuery => {} Type::Uuid => {} diff --git a/tests/discovery/postgres/Cargo.toml b/tests/discovery/postgres/Cargo.toml index 95ab5751..738723a5 100644 --- a/tests/discovery/postgres/Cargo.toml +++ b/tests/discovery/postgres/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } -sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "debug-print" ] } +sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-postgres", "runtime-async-std-native-tls", "discovery" ] } sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/discovery/postgres/schema.rs b/tests/discovery/postgres/schema.rs index 23968998..b3ecbc8b 100644 --- a/tests/discovery/postgres/schema.rs +++ b/tests/discovery/postgres/schema.rs @@ -1,855 +1,6 @@ -SELECT "table_name", "user_defined_type_schema", "user_defined_type_name" FROM "information_schema"."tables" WHERE "table_schema" = $1 AND "table_type" = $2, Values([String("public"), String("BASE TABLE")]) - -TableQueryResult { table_name: "actor", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "actor", of_type: None } -TableQueryResult { table_name: "film", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "film", of_type: None } -TableQueryResult { table_name: "payment_p2007_02", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "payment_p2007_02", of_type: None } -TableQueryResult { table_name: "payment_p2007_03", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "payment_p2007_03", of_type: None } -TableQueryResult { table_name: "payment_p2007_04", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "payment_p2007_04", of_type: None } -TableQueryResult { table_name: "payment_p2007_05", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "payment_p2007_05", of_type: None } -TableQueryResult { table_name: "payment_p2007_06", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "payment_p2007_06", of_type: None } -TableQueryResult { table_name: "payment_p2007_01", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "payment_p2007_01", of_type: None } -TableQueryResult { table_name: "address", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "address", of_type: None } -TableQueryResult { table_name: "category", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "category", of_type: None } -TableQueryResult { table_name: "city", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "city", of_type: None } -TableQueryResult { table_name: "country", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "country", of_type: None } -TableQueryResult { table_name: "customer", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "customer", of_type: None } -TableQueryResult { table_name: "film_actor", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "film_actor", of_type: None } -TableQueryResult { table_name: "film_category", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "film_category", of_type: None } -TableQueryResult { table_name: "inventory", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "inventory", of_type: None } -TableQueryResult { table_name: "language", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "language", of_type: None } -TableQueryResult { table_name: "rental", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "rental", of_type: None } -TableQueryResult { table_name: "staff", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "staff", of_type: None } -TableQueryResult { table_name: "store", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "store", of_type: None } -TableQueryResult { table_name: "payment", user_defined_type_schema: None, user_defined_type_name: None } -TableInfo { name: "payment", of_type: None } - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("actor")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("film")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_02")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_03")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_04")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_05")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_06")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment_p2007_01")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("address")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("category")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("city")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("country")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("customer")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("film_actor")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("film_category")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("inventory")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("language")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("rental")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("staff")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("store")]) - -SELECT "column_name", "data_type", "column_default", "generation_expression", "is_nullable", "numeric_precision", "numeric_precision_radix", "numeric_scale" FROM "information_schema"."columns" WHERE "table_schema" = $1 AND "table_name" = $2, Values([String("public"), String("payment")]) - -ColumnQueryResult { column_name: "category_id", column_type: "integer", column_default: Some("nextval(\'category_category_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "category_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'category_category_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("category")]) - -ColumnQueryResult { column_name: "film_id", column_type: "integer", column_default: Some("nextval(\'film_film_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "film_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'film_film_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "title", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "title", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "description", column_type: "text", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "description", col_type: Unknown("text is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "release_year", column_type: "integer", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "release_year", col_type: Integer, default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "language_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "language_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "original_language_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "original_language_id", col_type: SmallInt, default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "rental_duration", column_type: "smallint", column_default: Some("3"), column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_duration", col_type: SmallInt, default: Some(ColumnExpression("3")), generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_rate", column_type: "numeric", column_default: Some("4.99"), column_generated: None, is_nullable: "NO", numeric_precision: Some(4), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "rental_rate", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(4), scale: Some(2) }), default: Some(ColumnExpression("4.99")), generated: None, not_null: None } -ColumnQueryResult { column_name: "length", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "length", col_type: SmallInt, default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "replacement_cost", column_type: "numeric", column_default: Some("19.99"), column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "replacement_cost", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: Some(ColumnExpression("19.99")), generated: None, not_null: None } -ColumnQueryResult { column_name: "rating", column_type: "USER-DEFINED", column_default: Some("\'G\'::mpaa_rating"), column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "rating", col_type: Unknown("USER is unknown or unimplemented"), default: Some(ColumnExpression("\'G\'::mpaa_rating")), generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } -ColumnQueryResult { column_name: "special_features", column_type: "ARRAY", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "special_features", col_type: Unknown("ARRAY is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "fulltext", column_type: "tsvector", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "fulltext", col_type: Unknown("tsvector is unknown or unimplemented"), default: None, generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("film")]) - -ColumnQueryResult { column_name: "city_id", column_type: "integer", column_default: Some("nextval(\'city_city_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "city_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'city_city_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "city", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "city", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "country_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "country_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("city")]) - -ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_03")]) - -ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_04")]) - -ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_06")]) - -ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_01")]) - -ColumnQueryResult { column_name: "address_id", column_type: "integer", column_default: Some("nextval(\'address_address_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "address_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'address_address_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "address", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "address", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "address2", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "address2", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "district", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "district", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "city_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "city_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "postal_code", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "postal_code", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "phone", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "phone", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("address")]) - -ColumnQueryResult { column_name: "country_id", column_type: "integer", column_default: Some("nextval(\'country_country_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "country_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'country_country_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "country", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "country", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("country")]) - -ColumnQueryResult { column_name: "actor_id", column_type: "integer", column_default: Some("nextval(\'actor_actor_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "actor_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'actor_actor_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "first_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "first_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("actor")]) - -ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_02")]) - -ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment_p2007_05")]) - -ColumnQueryResult { column_name: "actor_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "actor_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "film_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "film_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("film_actor")]) - -ColumnQueryResult { column_name: "film_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "film_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "category_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "category_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("film_category")]) - -ColumnQueryResult { column_name: "inventory_id", column_type: "integer", column_default: Some("nextval(\'inventory_inventory_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "inventory_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'inventory_inventory_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "film_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "film_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "store_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "store_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("inventory")]) - -ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: Some("nextval(\'rental_rental_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'rental_rental_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "rental_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "inventory_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "inventory_id", col_type: Integer, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "return_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "return_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("rental")]) - -ColumnQueryResult { column_name: "staff_id", column_type: "integer", column_default: Some("nextval(\'staff_staff_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'staff_staff_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "first_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "first_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "address_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "address_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "email", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "email", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "store_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "store_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "active", column_type: "boolean", column_default: Some("true"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "active", col_type: Unknown("boolean is unknown or unimplemented"), default: Some(ColumnExpression("true")), generated: None, not_null: None } -ColumnQueryResult { column_name: "username", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "username", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "password", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "password", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } -ColumnQueryResult { column_name: "picture", column_type: "bytea", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "picture", col_type: Unknown("bytea is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("staff")]) - -ColumnQueryResult { column_name: "customer_id", column_type: "integer", column_default: Some("nextval(\'customer_customer_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'customer_customer_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "store_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "store_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "first_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "first_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_name", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "email", column_type: "character varying", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "email", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "address_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "address_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "activebool", column_type: "boolean", column_default: Some("true"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "activebool", col_type: Unknown("boolean is unknown or unimplemented"), default: Some(ColumnExpression("true")), generated: None, not_null: None } -ColumnQueryResult { column_name: "create_date", column_type: "date", column_default: Some("(\'now\'::text)::date"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "create_date", col_type: Unknown("date is unknown or unimplemented"), default: Some(ColumnExpression("(\'now\'::text)::date")), generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "YES", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: Some(NotNull) } -ColumnQueryResult { column_name: "active", column_type: "integer", column_default: None, column_generated: None, is_nullable: "YES", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "active", col_type: Integer, default: None, generated: None, not_null: Some(NotNull) } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("customer")]) - -ColumnQueryResult { column_name: "language_id", column_type: "integer", column_default: Some("nextval(\'language_language_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "language_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'language_language_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "name", column_type: "character", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "name", col_type: Unknown("character is unknown or unimplemented"), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("language")]) - -ColumnQueryResult { column_name: "store_id", column_type: "integer", column_default: Some("nextval(\'store_store_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "store_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'store_store_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "manager_staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "manager_staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "address_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "address_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "last_update", column_type: "timestamp without time zone", column_default: Some("now()"), column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "last_update", col_type: Unknown("timestamp is unknown or unimplemented"), default: Some(ColumnExpression("now()")), generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("store")]) - -ColumnQueryResult { column_name: "payment_id", column_type: "integer", column_default: Some("nextval(\'payment_payment_id_seq\'::regclass)"), column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "payment_id", col_type: Integer, default: Some(ColumnExpression("nextval(\'payment_payment_id_seq\'::regclass)")), generated: None, not_null: None } -ColumnQueryResult { column_name: "customer_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "staff_id", column_type: "smallint", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(16), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "rental_id", column_type: "integer", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(32), numeric_precision_radix: Some(2), numeric_scale: Some(0) } -ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "amount", column_type: "numeric", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: Some(5), numeric_precision_radix: Some(10), numeric_scale: Some(2) } -ColumnInfo { name: "amount", col_type: Numeric(ArbitraryPrecisionNumericAttr { precision: Some(5), scale: Some(2) }), default: None, generated: None, not_null: None } -ColumnQueryResult { column_name: "payment_date", column_type: "timestamp without time zone", column_default: None, column_generated: None, is_nullable: "NO", numeric_precision: None, numeric_precision_radix: None, numeric_scale: None } -ColumnInfo { name: "payment_date", col_type: Unknown("timestamp is unknown or unimplemented"), default: None, generated: None, not_null: None } - -SELECT "table_constraints"."constraint_schema", "table_constraints"."constraint_name", "table_constraints"."table_schema", "table_constraints"."table_name", "table_constraints"."constraint_type", "table_constraints"."is_deferrable", "table_constraints"."initially_deferred", "check_constraints"."check_clause", "key_column_usage"."column_name", "key_column_usage"."ordinal_position", "key_column_usage"."position_in_unique_constraint", "referential_constraints_subquery"."unique_constraint_schema", "referential_constraints_subquery"."unique_constraint_name", "referential_constraints_subquery"."match_option", "referential_constraints_subquery"."update_rule", "referential_constraints_subquery"."delete_rule", "referential_constraints_subquery"."table_name", "referential_constraints_subquery"."column_name" FROM "information_schema"."table_constraints" LEFT JOIN "information_schema"."check_constraints" ON "table_constraints"."constraint_name" = "check_constraints"."constraint_name" LEFT JOIN "information_schema"."key_column_usage" ON "table_constraints"."constraint_name" = "key_column_usage"."constraint_name" LEFT JOIN (SELECT "referential_constraints"."constraint_name", "referential_constraints"."unique_constraint_schema", "referential_constraints"."unique_constraint_name", "referential_constraints"."match_option", "referential_constraints"."update_rule", "referential_constraints"."delete_rule", "key_column_usage"."table_name", "key_column_usage"."column_name" FROM "information_schema"."referential_constraints" LEFT JOIN "information_schema"."key_column_usage" ON "referential_constraints"."unique_constraint_name" = "key_column_usage"."constraint_name") AS "referential_constraints_subquery" ON "table_constraints"."constraint_name" = "referential_constraints_subquery"."constraint_name" WHERE "table_constraints"."table_schema" = $1 AND "table_constraints"."table_name" = $2 ORDER BY "table_constraints"."constraint_name" ASC, "key_column_usage"."ordinal_position" ASC, "referential_constraints_subquery"."unique_constraint_name" ASC, "referential_constraints_subquery"."constraint_name" ASC, Values([String("public"), String("payment")]) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_10_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("replacement_cost IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_12_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_14_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("fulltext IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_1_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("film_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_2_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("title IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_5_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("language_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_7_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_duration IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25011_8_not_null", table_schema: "public", table_name: "film", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_rate IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_language_id_fkey", table_schema: "public", table_name: "film", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("language_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("language_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("language"), referential_key_column_name: Some("language_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_original_language_id_fkey", table_schema: "public", table_name: "film", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("original_language_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("language_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("language"), referential_key_column_name: Some("language_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_pkey", table_schema: "public", table_name: "film", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "replacement_cost IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -Check(Check { expr: "fulltext IS NOT NULL", no_inherit: false }) -Check(Check { expr: "film_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "title IS NOT NULL", no_inherit: false }) -Check(Check { expr: "language_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_duration IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_rate IS NOT NULL", no_inherit: false }) -References(References { columns: ["language_id"], table: "language", foreign_columns: ["language_id"] }) -References(References { columns: ["original_language_id"], table: "language", foreign_columns: ["language_id"] }) -PrimaryKey(PrimaryKey(["film_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_1_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_2_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_3_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_4_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_5_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25116_6_not_null", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_04_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_04_payment_date_check", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-04-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-05-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_04_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_04_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_04", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } - -Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) -Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) -References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) -Check(Check { expr: "(((payment_date >= \'2007-04-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-05-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) -References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) -References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25004_1_not_null", table_schema: "public", table_name: "category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("category_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25004_2_not_null", table_schema: "public", table_name: "category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25004_3_not_null", table_schema: "public", table_name: "category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "category_pkey", table_schema: "public", table_name: "category", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("category_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "category_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "name IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -PrimaryKey(PrimaryKey(["category_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_1_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_2_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_3_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_4_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_5_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25106_6_not_null", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_02_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_02_payment_date_check", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-02-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-03-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_02_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_02_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_02", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } - -Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) -Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) -References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) -Check(Check { expr: "(((payment_date >= \'2007-02-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-03-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) -References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) -References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_1_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_2_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_3_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_4_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_5_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25121_6_not_null", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_05_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_05_payment_date_check", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-05-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-06-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_05_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_05_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_05", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } - -Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) -Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) -References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) -Check(Check { expr: "(((payment_date >= \'2007-05-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-06-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) -References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) -References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_1_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_2_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_3_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_4_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_5_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25101_6_not_null", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_01_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_01_payment_date_check", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-01-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-02-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_01_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_01_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_01", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } - -Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) -Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) -References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) -Check(Check { expr: "(((payment_date >= \'2007-01-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-02-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) -References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) -References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_24980_1_not_null", table_schema: "public", table_name: "actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("actor_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_24980_2_not_null", table_schema: "public", table_name: "actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("first_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_24980_3_not_null", table_schema: "public", table_name: "actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_24980_4_not_null", table_schema: "public", table_name: "actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "actor_pkey", table_schema: "public", table_name: "actor", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("actor_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "actor_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "first_name IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_name IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -PrimaryKey(PrimaryKey(["actor_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_1_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_2_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_4_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("district IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_5_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("city_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_7_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("phone IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25038_8_not_null", table_schema: "public", table_name: "address", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "address_city_id_fkey", table_schema: "public", table_name: "address", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("city_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("city_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("city"), referential_key_column_name: Some("city_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "address_pkey", table_schema: "public", table_name: "address", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("address_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "address_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "address IS NOT NULL", no_inherit: false }) -Check(Check { expr: "district IS NOT NULL", no_inherit: false }) -Check(Check { expr: "city_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "phone IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -References(References { columns: ["city_id"], table: "city", foreign_columns: ["city_id"] }) -PrimaryKey(PrimaryKey(["address_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_1_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_2_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_3_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_4_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_5_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25111_6_not_null", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_03_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_03_payment_date_check", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-03-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-04-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_03_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_03_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_03", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } - -Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) -Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) -References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) -Check(Check { expr: "(((payment_date >= \'2007-03-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-04-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) -References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) -References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25052_1_not_null", table_schema: "public", table_name: "country", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("country_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25052_2_not_null", table_schema: "public", table_name: "country", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("country IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25052_3_not_null", table_schema: "public", table_name: "country", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "country_pkey", table_schema: "public", table_name: "country", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("country_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "country_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "country IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -PrimaryKey(PrimaryKey(["country_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_1_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_2_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_3_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_4_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_5_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25126_6_not_null", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_06_customer_id_fkey", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_06_payment_date_check", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("(((payment_date >= \'2007-06-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-07-01 00:00:00\'::timestamp without time zone)))"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_06_rental_id_fkey", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_p2007_06_staff_id_fkey", table_schema: "public", table_name: "payment_p2007_06", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } - -Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) -Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) -References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) -Check(Check { expr: "(((payment_date >= \'2007-06-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-07-01 00:00:00\'::timestamp without time zone)))", no_inherit: false }) -References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) -References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25045_1_not_null", table_schema: "public", table_name: "city", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("city_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25045_2_not_null", table_schema: "public", table_name: "city", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("city IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25045_3_not_null", table_schema: "public", table_name: "city", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("country_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25045_4_not_null", table_schema: "public", table_name: "city", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "city_country_id_fkey", table_schema: "public", table_name: "city", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("country_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("country_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("country"), referential_key_column_name: Some("country_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "city_pkey", table_schema: "public", table_name: "city", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("city_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "city_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "city IS NOT NULL", no_inherit: false }) -Check(Check { expr: "country_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -References(References { columns: ["country_id"], table: "country", foreign_columns: ["country_id"] }) -PrimaryKey(PrimaryKey(["city_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25023_1_not_null", table_schema: "public", table_name: "film_actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("actor_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25023_2_not_null", table_schema: "public", table_name: "film_actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("film_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25023_3_not_null", table_schema: "public", table_name: "film_actor", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_actor_actor_id_fkey", table_schema: "public", table_name: "film_actor", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("actor_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("actor_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("actor"), referential_key_column_name: Some("actor_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_actor_film_id_fkey", table_schema: "public", table_name: "film_actor", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("film_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("film"), referential_key_column_name: Some("film_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_actor_pkey", table_schema: "public", table_name: "film_actor", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("actor_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_actor_pkey", table_schema: "public", table_name: "film_actor", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(2), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "actor_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "film_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -References(References { columns: ["actor_id"], table: "actor", foreign_columns: ["actor_id"] }) -References(References { columns: ["film_id"], table: "film", foreign_columns: ["film_id"] }) -PrimaryKey(PrimaryKey(["actor_id", "film_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25078_1_not_null", table_schema: "public", table_name: "inventory", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("inventory_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25078_2_not_null", table_schema: "public", table_name: "inventory", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("film_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25078_3_not_null", table_schema: "public", table_name: "inventory", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("store_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25078_4_not_null", table_schema: "public", table_name: "inventory", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "inventory_film_id_fkey", table_schema: "public", table_name: "inventory", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("film_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("film"), referential_key_column_name: Some("film_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "inventory_pkey", table_schema: "public", table_name: "inventory", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("inventory_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "inventory_store_id_fkey", table_schema: "public", table_name: "inventory", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("store_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("store_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("store"), referential_key_column_name: Some("store_id") } - -Check(Check { expr: "inventory_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "film_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "store_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -References(References { columns: ["film_id"], table: "film", foreign_columns: ["film_id"] }) -PrimaryKey(PrimaryKey(["inventory_id"])) -References(References { columns: ["store_id"], table: "store", foreign_columns: ["store_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25027_1_not_null", table_schema: "public", table_name: "film_category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("film_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25027_2_not_null", table_schema: "public", table_name: "film_category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("category_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25027_3_not_null", table_schema: "public", table_name: "film_category", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_category_category_id_fkey", table_schema: "public", table_name: "film_category", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("category_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("category_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("category"), referential_key_column_name: Some("category_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_category_film_id_fkey", table_schema: "public", table_name: "film_category", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("film_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("film"), referential_key_column_name: Some("film_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_category_pkey", table_schema: "public", table_name: "film_category", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("film_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "film_category_pkey", table_schema: "public", table_name: "film_category", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("category_id"), ordinal_position: Some(2), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "film_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "category_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -References(References { columns: ["category_id"], table: "category", foreign_columns: ["category_id"] }) -References(References { columns: ["film_id"], table: "film", foreign_columns: ["film_id"] }) -PrimaryKey(PrimaryKey(["film_id", "category_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_1_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_2_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_3_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("inventory_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_4_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_6_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25133_7_not_null", table_schema: "public", table_name: "rental", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "rental_customer_id_fkey", table_schema: "public", table_name: "rental", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "rental_inventory_id_fkey", table_schema: "public", table_name: "rental", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("inventory_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("inventory_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("inventory"), referential_key_column_name: Some("inventory_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "rental_pkey", table_schema: "public", table_name: "rental", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "rental_staff_id_fkey", table_schema: "public", table_name: "rental", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } - -Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_date IS NOT NULL", no_inherit: false }) -Check(Check { expr: "inventory_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) -References(References { columns: ["inventory_id"], table: "inventory", foreign_columns: ["inventory_id"] }) -PrimaryKey(PrimaryKey(["rental_id"])) -References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_10_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_1_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_2_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("first_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_3_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_4_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_6_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("store_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_7_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("active IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25145_8_not_null", table_schema: "public", table_name: "staff", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("username IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "staff_address_id_fkey", table_schema: "public", table_name: "staff", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("address_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("address_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("address"), referential_key_column_name: Some("address_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "staff_pkey", table_schema: "public", table_name: "staff", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "staff_store_id_fkey", table_schema: "public", table_name: "staff", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("store_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("store_pkey"), match_option: Some("NONE"), update_rule: Some("NO ACTION"), delete_rule: Some("NO ACTION"), referential_key_table_name: Some("store"), referential_key_column_name: Some("store_id") } - -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "first_name IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_name IS NOT NULL", no_inherit: false }) -Check(Check { expr: "address_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "store_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "active IS NOT NULL", no_inherit: false }) -Check(Check { expr: "username IS NOT NULL", no_inherit: false }) -References(References { columns: ["address_id"], table: "address", foreign_columns: ["address_id"] }) -PrimaryKey(PrimaryKey(["staff_id"])) -References(References { columns: ["store_id"], table: "store", foreign_columns: ["store_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_1_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_2_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("store_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_3_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("first_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_4_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_6_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_7_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("activebool IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25059_8_not_null", table_schema: "public", table_name: "customer", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("create_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "customer_address_id_fkey", table_schema: "public", table_name: "customer", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("address_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("address_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("address"), referential_key_column_name: Some("address_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "customer_pkey", table_schema: "public", table_name: "customer", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "customer_store_id_fkey", table_schema: "public", table_name: "customer", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("store_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("store_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("store"), referential_key_column_name: Some("store_id") } - -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "store_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "first_name IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_name IS NOT NULL", no_inherit: false }) -Check(Check { expr: "address_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "activebool IS NOT NULL", no_inherit: false }) -Check(Check { expr: "create_date IS NOT NULL", no_inherit: false }) -References(References { columns: ["address_id"], table: "address", foreign_columns: ["address_id"] }) -PrimaryKey(PrimaryKey(["customer_id"])) -References(References { columns: ["store_id"], table: "store", foreign_columns: ["store_id"] }) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25085_1_not_null", table_schema: "public", table_name: "language", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("language_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25085_2_not_null", table_schema: "public", table_name: "language", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("name IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25085_3_not_null", table_schema: "public", table_name: "language", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "language_pkey", table_schema: "public", table_name: "language", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("language_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "language_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "name IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -PrimaryKey(PrimaryKey(["language_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25156_1_not_null", table_schema: "public", table_name: "store", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("store_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25156_2_not_null", table_schema: "public", table_name: "store", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("manager_staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25156_3_not_null", table_schema: "public", table_name: "store", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("address_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25156_4_not_null", table_schema: "public", table_name: "store", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("last_update IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "store_address_id_fkey", table_schema: "public", table_name: "store", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("address_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("address_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("address"), referential_key_column_name: Some("address_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "store_manager_staff_id_fkey", table_schema: "public", table_name: "store", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("manager_staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "store_pkey", table_schema: "public", table_name: "store", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("store_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } - -Check(Check { expr: "store_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "manager_staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "address_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "last_update IS NOT NULL", no_inherit: false }) -References(References { columns: ["address_id"], table: "address", foreign_columns: ["address_id"] }) -References(References { columns: ["manager_staff_id"], table: "staff", foreign_columns: ["staff_id"] }) -PrimaryKey(PrimaryKey(["store_id"])) - -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_1_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_2_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("customer_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_3_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("staff_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_4_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("rental_id IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_5_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("amount IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "2200_25097_6_not_null", table_schema: "public", table_name: "payment", constraint_type: "CHECK", is_deferrable: "NO", initially_deferred: "NO", check_clause: Some("payment_date IS NOT NULL"), column_name: None, ordinal_position: None, position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_customer_id_fkey", table_schema: "public", table_name: "payment", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("customer_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("customer_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("customer"), referential_key_column_name: Some("customer_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_pkey", table_schema: "public", table_name: "payment", constraint_type: "PRIMARY KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("payment_id"), ordinal_position: Some(1), position_in_unique_constraint: None, unique_constraint_schema: None, unique_constraint_name: None, match_option: None, update_rule: None, delete_rule: None, referential_key_table_name: None, referential_key_column_name: None } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_rental_id_fkey", table_schema: "public", table_name: "payment", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("rental_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("rental_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("SET NULL"), referential_key_table_name: Some("rental"), referential_key_column_name: Some("rental_id") } -TableConstraintsQueryResult { constraint_schema: "public", constraint_name: "payment_staff_id_fkey", table_schema: "public", table_name: "payment", constraint_type: "FOREIGN KEY", is_deferrable: "NO", initially_deferred: "NO", check_clause: None, column_name: Some("staff_id"), ordinal_position: Some(1), position_in_unique_constraint: Some(1), unique_constraint_schema: Some("public"), unique_constraint_name: Some("staff_pkey"), match_option: Some("NONE"), update_rule: Some("CASCADE"), delete_rule: Some("RESTRICT"), referential_key_table_name: Some("staff"), referential_key_column_name: Some("staff_id") } - -Check(Check { expr: "payment_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "customer_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "staff_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "rental_id IS NOT NULL", no_inherit: false }) -Check(Check { expr: "amount IS NOT NULL", no_inherit: false }) -Check(Check { expr: "payment_date IS NOT NULL", no_inherit: false }) -References(References { columns: ["customer_id"], table: "customer", foreign_columns: ["customer_id"] }) -PrimaryKey(PrimaryKey(["payment_id"])) -References(References { columns: ["rental_id"], table: "rental", foreign_columns: ["rental_id"] }) -References(References { columns: ["staff_id"], table: "staff", foreign_columns: ["staff_id"] }) - Schema { schema: "public", tables: [ - TableDef { - info: TableInfo { - name: "actor", - of_type: None, - }, - columns: [ - ColumnInfo { - name: "actor_id", - col_type: Integer, - default: Some( - ColumnExpression( - "nextval(\'actor_actor_id_seq\'::regclass)", - ), - ), - generated: None, - not_null: None, - }, - ColumnInfo { - name: "first_name", - col_type: Unknown( - "character is unknown or unimplemented", - ), - default: None, - generated: None, - not_null: None, - }, - ColumnInfo { - name: "last_name", - col_type: Unknown( - "character is unknown or unimplemented", - ), - default: None, - generated: None, - not_null: None, - }, - ColumnInfo { - name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), - default: Some( - ColumnExpression( - "now()", - ), - ), - generated: None, - not_null: None, - }, - ], - check_constraints: [ - Check { - expr: "actor_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "first_name IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "last_name IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "last_update IS NOT NULL", - no_inherit: false, - }, - ], - unique_keys: [], - references: [], - of_type: None, - }, TableDef { info: TableInfo { name: "film", @@ -861,56 +12,58 @@ Schema { col_type: Integer, default: Some( ColumnExpression( - "nextval(\'film_film_id_seq\'::regclass)", + "nextval('film_film_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "title", - col_type: Unknown( - "character is unknown or unimplemented", + col_type: Char( + StringAttr { + length: Some( + 255, + ), + }, ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "description", - col_type: Unknown( - "text is unknown or unimplemented", - ), + col_type: Text, default: None, generated: None, - not_null: Some( - NotNull, - ), + not_null: None, }, ColumnInfo { name: "release_year", col_type: Integer, default: None, generated: None, - not_null: Some( - NotNull, - ), + not_null: None, }, ColumnInfo { name: "language_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "original_language_id", col_type: SmallInt, default: None, generated: None, - not_null: Some( - NotNull, - ), + not_null: None, }, ColumnInfo { name: "rental_duration", @@ -921,7 +74,9 @@ Schema { ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "rental_rate", @@ -941,16 +96,16 @@ Schema { ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "length", col_type: SmallInt, default: None, generated: None, - not_null: Some( - NotNull, - ), + not_null: None, }, ColumnInfo { name: "replacement_cost", @@ -970,27 +125,31 @@ Schema { ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "rating", col_type: Unknown( - "USER is unknown or unimplemented", + "USER", ), default: Some( ColumnExpression( - "\'G\'::mpaa_rating", + "'G'::mpaa_rating", ), ), generated: None, - not_null: Some( - NotNull, - ), + not_null: None, }, ColumnInfo { name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: Some( ColumnExpression( @@ -998,27 +157,25 @@ Schema { ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "special_features", - col_type: Unknown( - "ARRAY is unknown or unimplemented", - ), + col_type: Array, default: None, generated: None, - not_null: Some( - NotNull, - ), + not_null: None, }, ColumnInfo { name: "fulltext", - col_type: Unknown( - "tsvector is unknown or unimplemented", - ), + col_type: TsVector, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ @@ -1055,8 +212,16 @@ Schema { no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "film_id", + ], + ), + ], + reference_constraints: [ References { columns: [ "language_id", @@ -1076,55 +241,86 @@ Schema { ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "payment_p2007_02", + name: "address", of_type: None, }, columns: [ ColumnInfo { - name: "payment_id", + name: "address_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'payment_payment_id_seq\'::regclass)", + "nextval('address_address_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "customer_id", - col_type: SmallInt, + name: "address", + col_type: Char( + StringAttr { + length: Some( + 50, + ), + }, + ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "staff_id", - col_type: SmallInt, + name: "address2", + col_type: Char( + StringAttr { + length: Some( + 50, + ), + }, + ), default: None, generated: None, not_null: None, }, ColumnInfo { - name: "rental_id", - col_type: Integer, + name: "district", + col_type: Char( + StringAttr { + length: Some( + 20, + ), + }, + ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "amount", - col_type: Numeric( - ArbitraryPrecisionNumericAttr { - precision: Some( - 5, - ), - scale: Some( - 2, + name: "city_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "postal_code", + col_type: Char( + StringAttr { + length: Some( + 10, ), }, ), @@ -1133,388 +329,481 @@ Schema { not_null: None, }, ColumnInfo { - name: "payment_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", + name: "phone", + col_type: Char( + StringAttr { + length: Some( + 20, + ), + }, ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "last_update", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "payment_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "customer_id IS NOT NULL", + expr: "address_id IS NOT NULL", no_inherit: false, }, Check { - expr: "staff_id IS NOT NULL", + expr: "address IS NOT NULL", no_inherit: false, }, Check { - expr: "rental_id IS NOT NULL", + expr: "district IS NOT NULL", no_inherit: false, }, Check { - expr: "amount IS NOT NULL", + expr: "city_id IS NOT NULL", no_inherit: false, }, Check { - expr: "payment_date IS NOT NULL", + expr: "phone IS NOT NULL", no_inherit: false, }, Check { - expr: "(((payment_date >= \'2007-02-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-03-01 00:00:00\'::timestamp without time zone)))", + expr: "last_update IS NOT NULL", no_inherit: false, }, ], - unique_keys: [], - references: [ - References { - columns: [ - "customer_id", - ], - table: "customer", - foreign_columns: [ - "customer_id", - ], - }, - References { - columns: [ - "rental_id", - ], - table: "rental", - foreign_columns: [ - "rental_id", + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "address_id", ], - }, + ), + ], + reference_constraints: [ References { columns: [ - "staff_id", + "city_id", ], - table: "staff", + table: "city", foreign_columns: [ - "staff_id", + "city_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "payment_p2007_03", + name: "category", of_type: None, }, columns: [ ColumnInfo { - name: "payment_id", + name: "category_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'payment_payment_id_seq\'::regclass)", + "nextval('category_category_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "customer_id", - col_type: SmallInt, + name: "name", + col_type: Char( + StringAttr { + length: Some( + 25, + ), + }, + ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "staff_id", - col_type: SmallInt, - default: None, + name: "last_update", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, + ), + default: Some( + ColumnExpression( + "now()", + ), + ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, + ], + check_constraints: [ + Check { + expr: "category_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "category_id", + ], + ), + ], + reference_constraints: [], + exclusion_constraints: [], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "city", + of_type: None, + }, + columns: [ ColumnInfo { - name: "rental_id", + name: "city_id", col_type: Integer, - default: None, + default: Some( + ColumnExpression( + "nextval('city_city_id_seq'::regclass)", + ), + ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "amount", - col_type: Numeric( - ArbitraryPrecisionNumericAttr { - precision: Some( - 5, - ), - scale: Some( - 2, + name: "city", + col_type: Char( + StringAttr { + length: Some( + 50, ), }, ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "payment_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), + name: "country_id", + col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "last_update", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "payment_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "customer_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "staff_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "rental_id IS NOT NULL", + expr: "city_id IS NOT NULL", no_inherit: false, }, Check { - expr: "amount IS NOT NULL", + expr: "city IS NOT NULL", no_inherit: false, }, Check { - expr: "payment_date IS NOT NULL", + expr: "country_id IS NOT NULL", no_inherit: false, }, Check { - expr: "(((payment_date >= \'2007-03-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-04-01 00:00:00\'::timestamp without time zone)))", + expr: "last_update IS NOT NULL", no_inherit: false, }, ], - unique_keys: [], - references: [ - References { - columns: [ - "customer_id", - ], - table: "customer", - foreign_columns: [ - "customer_id", - ], - }, - References { - columns: [ - "rental_id", - ], - table: "rental", - foreign_columns: [ - "rental_id", + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "city_id", ], - }, + ), + ], + reference_constraints: [ References { columns: [ - "staff_id", + "country_id", ], - table: "staff", + table: "country", foreign_columns: [ - "staff_id", + "country_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "payment_p2007_04", + name: "country", of_type: None, }, columns: [ ColumnInfo { - name: "payment_id", + name: "country_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'payment_payment_id_seq\'::regclass)", + "nextval('country_country_id_seq'::regclass)", ), ), generated: None, - not_null: None, - }, - ColumnInfo { - name: "customer_id", - col_type: SmallInt, - default: None, - generated: None, - not_null: None, - }, - ColumnInfo { - name: "staff_id", - col_type: SmallInt, - default: None, - generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "rental_id", - col_type: Integer, + name: "country", + col_type: Char( + StringAttr { + length: Some( + 50, + ), + }, + ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "amount", - col_type: Numeric( - ArbitraryPrecisionNumericAttr { + name: "last_update", + col_type: Timestamp( + TimeAttr { precision: Some( - 5, - ), - scale: Some( - 2, + 6, ), }, ), - default: None, - generated: None, - not_null: None, - }, - ColumnInfo { - name: "payment_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", + default: Some( + ColumnExpression( + "now()", + ), ), - default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "payment_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "customer_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "staff_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "rental_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "amount IS NOT NULL", + expr: "country_id IS NOT NULL", no_inherit: false, }, Check { - expr: "payment_date IS NOT NULL", + expr: "country IS NOT NULL", no_inherit: false, }, Check { - expr: "(((payment_date >= \'2007-04-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-05-01 00:00:00\'::timestamp without time zone)))", + expr: "last_update IS NOT NULL", no_inherit: false, }, ], - unique_keys: [], - references: [ - References { - columns: [ - "customer_id", - ], - table: "customer", - foreign_columns: [ - "customer_id", - ], - }, - References { - columns: [ - "rental_id", - ], - table: "rental", - foreign_columns: [ - "rental_id", - ], - }, - References { - columns: [ - "staff_id", - ], - table: "staff", - foreign_columns: [ - "staff_id", + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "country_id", ], - }, + ), ], + reference_constraints: [], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "payment_p2007_05", + name: "customer", of_type: None, }, columns: [ ColumnInfo { - name: "payment_id", + name: "customer_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'payment_payment_id_seq\'::regclass)", + "nextval('customer_customer_id_seq'::regclass)", ), ), generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "store_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "first_name", + col_type: Char( + StringAttr { + length: Some( + 45, + ), + }, + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "last_name", + col_type: Char( + StringAttr { + length: Some( + 45, + ), + }, + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "email", + col_type: Char( + StringAttr { + length: Some( + 50, + ), + }, + ), + default: None, + generated: None, not_null: None, }, ColumnInfo { - name: "customer_id", + name: "address_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "staff_id", - col_type: SmallInt, - default: None, + name: "activebool", + col_type: Boolean, + default: Some( + ColumnExpression( + "true", + ), + ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "rental_id", - col_type: Integer, - default: None, + name: "create_date", + col_type: Date, + default: Some( + ColumnExpression( + "('now'::text)::date", + ), + ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "amount", - col_type: Numeric( - ArbitraryPrecisionNumericAttr { + name: "last_update", + col_type: Timestamp( + TimeAttr { precision: Some( - 5, - ), - scale: Some( - 2, + 6, ), }, ), - default: None, + default: Some( + ColumnExpression( + "now()", + ), + ), generated: None, not_null: None, }, ColumnInfo { - name: "payment_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), + name: "active", + col_type: Integer, default: None, generated: None, not_null: None, @@ -1522,349 +811,270 @@ Schema { ], check_constraints: [ Check { - expr: "payment_id IS NOT NULL", + expr: "customer_id IS NOT NULL", no_inherit: false, }, Check { - expr: "customer_id IS NOT NULL", + expr: "store_id IS NOT NULL", no_inherit: false, }, Check { - expr: "staff_id IS NOT NULL", + expr: "first_name IS NOT NULL", no_inherit: false, }, Check { - expr: "rental_id IS NOT NULL", + expr: "last_name IS NOT NULL", no_inherit: false, }, Check { - expr: "amount IS NOT NULL", + expr: "address_id IS NOT NULL", no_inherit: false, }, Check { - expr: "payment_date IS NOT NULL", + expr: "activebool IS NOT NULL", no_inherit: false, }, Check { - expr: "(((payment_date >= \'2007-05-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-06-01 00:00:00\'::timestamp without time zone)))", + expr: "create_date IS NOT NULL", no_inherit: false, }, ], - unique_keys: [], - references: [ - References { - columns: [ - "customer_id", - ], - table: "customer", - foreign_columns: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ "customer_id", ], - }, + ), + ], + reference_constraints: [ References { columns: [ - "rental_id", + "address_id", ], - table: "rental", + table: "address", foreign_columns: [ - "rental_id", + "address_id", ], }, References { columns: [ - "staff_id", + "store_id", ], - table: "staff", + table: "store", foreign_columns: [ - "staff_id", + "store_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "payment_p2007_06", + name: "film_actor", of_type: None, }, columns: [ ColumnInfo { - name: "payment_id", - col_type: Integer, - default: Some( - ColumnExpression( - "nextval(\'payment_payment_id_seq\'::regclass)", - ), - ), - generated: None, - not_null: None, - }, - ColumnInfo { - name: "customer_id", + name: "actor_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "staff_id", + name: "film_id", col_type: SmallInt, default: None, generated: None, - not_null: None, - }, - ColumnInfo { - name: "rental_id", - col_type: Integer, - default: None, - generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "amount", - col_type: Numeric( - ArbitraryPrecisionNumericAttr { + name: "last_update", + col_type: Timestamp( + TimeAttr { precision: Some( - 5, - ), - scale: Some( - 2, + 6, ), }, ), - default: None, - generated: None, - not_null: None, - }, - ColumnInfo { - name: "payment_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", + default: Some( + ColumnExpression( + "now()", + ), ), - default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "payment_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "customer_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "staff_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "rental_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "amount IS NOT NULL", + expr: "actor_id IS NOT NULL", no_inherit: false, }, Check { - expr: "payment_date IS NOT NULL", + expr: "film_id IS NOT NULL", no_inherit: false, }, Check { - expr: "(((payment_date >= \'2007-06-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-07-01 00:00:00\'::timestamp without time zone)))", + expr: "last_update IS NOT NULL", no_inherit: false, }, ], - unique_keys: [], - references: [ - References { - columns: [ - "customer_id", - ], - table: "customer", - foreign_columns: [ - "customer_id", + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "actor_id", + "film_id", ], - }, + ), + ], + reference_constraints: [ References { columns: [ - "rental_id", + "actor_id", ], - table: "rental", + table: "actor", foreign_columns: [ - "rental_id", + "actor_id", ], }, References { columns: [ - "staff_id", + "film_id", ], - table: "staff", + table: "film", foreign_columns: [ - "staff_id", + "film_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "payment_p2007_01", + name: "film_category", of_type: None, }, columns: [ ColumnInfo { - name: "payment_id", - col_type: Integer, - default: Some( - ColumnExpression( - "nextval(\'payment_payment_id_seq\'::regclass)", - ), - ), - generated: None, - not_null: None, - }, - ColumnInfo { - name: "customer_id", + name: "film_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "staff_id", + name: "category_id", col_type: SmallInt, default: None, generated: None, - not_null: None, - }, - ColumnInfo { - name: "rental_id", - col_type: Integer, - default: None, - generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "amount", - col_type: Numeric( - ArbitraryPrecisionNumericAttr { + name: "last_update", + col_type: Timestamp( + TimeAttr { precision: Some( - 5, - ), - scale: Some( - 2, + 6, ), }, ), - default: None, - generated: None, - not_null: None, - }, - ColumnInfo { - name: "payment_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", + default: Some( + ColumnExpression( + "now()", + ), ), - default: None, generated: None, - not_null: None, - }, - ], - check_constraints: [ - Check { - expr: "payment_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "customer_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "staff_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "rental_id IS NOT NULL", - no_inherit: false, + not_null: Some( + NotNull, + ), }, + ], + check_constraints: [ Check { - expr: "amount IS NOT NULL", + expr: "film_id IS NOT NULL", no_inherit: false, }, Check { - expr: "payment_date IS NOT NULL", + expr: "category_id IS NOT NULL", no_inherit: false, }, Check { - expr: "(((payment_date >= \'2007-01-01 00:00:00\'::timestamp without time zone) AND (payment_date < \'2007-02-01 00:00:00\'::timestamp without time zone)))", + expr: "last_update IS NOT NULL", no_inherit: false, }, ], - unique_keys: [], - references: [ - References { - columns: [ - "customer_id", - ], - table: "customer", - foreign_columns: [ - "customer_id", + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "film_id", + "category_id", ], - }, + ), + ], + reference_constraints: [ References { columns: [ - "rental_id", + "category_id", ], - table: "rental", + table: "category", foreign_columns: [ - "rental_id", + "category_id", ], }, References { columns: [ - "staff_id", + "film_id", ], - table: "staff", + table: "film", foreign_columns: [ - "staff_id", + "film_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "address", + name: "inventory", of_type: None, }, columns: [ ColumnInfo { - name: "address_id", + name: "inventory_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'address_address_id_seq\'::regclass)", + "nextval('inventory_inventory_id_seq'::regclass)", ), ), generated: None, - not_null: None, - }, - ColumnInfo { - name: "address", - col_type: Unknown( - "character is unknown or unimplemented", + not_null: Some( + NotNull, ), - default: None, - generated: None, - not_null: None, }, ColumnInfo { - name: "address2", - col_type: Unknown( - "character is unknown or unimplemented", - ), + name: "film_id", + col_type: SmallInt, default: None, generated: None, not_null: Some( @@ -1872,45 +1082,22 @@ Schema { ), }, ColumnInfo { - name: "district", - col_type: Unknown( - "character is unknown or unimplemented", - ), - default: None, - generated: None, - not_null: None, - }, - ColumnInfo { - name: "city_id", + name: "store_id", col_type: SmallInt, default: None, generated: None, - not_null: None, - }, - ColumnInfo { - name: "postal_code", - col_type: Unknown( - "character is unknown or unimplemented", - ), - default: None, - generated: None, not_null: Some( NotNull, ), }, - ColumnInfo { - name: "phone", - col_type: Unknown( - "character is unknown or unimplemented", - ), - default: None, - generated: None, - not_null: None, - }, ColumnInfo { name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: Some( ColumnExpression( @@ -1918,28 +1105,22 @@ Schema { ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "address_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "address IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "district IS NOT NULL", + expr: "inventory_id IS NOT NULL", no_inherit: false, }, Check { - expr: "city_id IS NOT NULL", + expr: "film_id IS NOT NULL", no_inherit: false, }, Check { - expr: "phone IS NOT NULL", + expr: "store_id IS NOT NULL", no_inherit: false, }, Check { @@ -1947,50 +1128,80 @@ Schema { no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "inventory_id", + ], + ), + ], + reference_constraints: [ References { columns: [ - "city_id", + "film_id", ], - table: "city", + table: "film", foreign_columns: [ - "city_id", + "film_id", + ], + }, + References { + columns: [ + "store_id", + ], + table: "store", + foreign_columns: [ + "store_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "category", + name: "language", of_type: None, }, columns: [ ColumnInfo { - name: "category_id", + name: "language_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'category_category_id_seq\'::regclass)", + "nextval('language_language_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "name", - col_type: Unknown( - "character is unknown or unimplemented", + col_type: Char( + StringAttr { + length: Some( + 20, + ), + }, ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: Some( ColumnExpression( @@ -1998,12 +1209,14 @@ Schema { ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "category_id IS NOT NULL", + expr: "language_id IS NOT NULL", no_inherit: false, }, Check { @@ -2015,119 +1228,101 @@ Schema { no_inherit: false, }, ], - unique_keys: [], - references: [], + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "language_id", + ], + ), + ], + reference_constraints: [], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "city", + name: "rental", of_type: None, }, columns: [ ColumnInfo { - name: "city_id", + name: "rental_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'city_city_id_seq\'::regclass)", + "nextval('rental_rental_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "city", - col_type: Unknown( - "character is unknown or unimplemented", + name: "rental_date", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "country_id", - col_type: SmallInt, + name: "inventory_id", + col_type: Integer, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), - default: Some( - ColumnExpression( - "now()", - ), - ), + name: "customer_id", + col_type: SmallInt, + default: None, generated: None, - not_null: None, - }, - ], - check_constraints: [ - Check { - expr: "city_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "city IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "country_id IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "last_update IS NOT NULL", - no_inherit: false, - }, - ], - unique_keys: [], - references: [ - References { - columns: [ - "country_id", - ], - table: "country", - foreign_columns: [ - "country_id", - ], + not_null: Some( + NotNull, + ), }, - ], - of_type: None, - }, - TableDef { - info: TableInfo { - name: "country", - of_type: None, - }, - columns: [ ColumnInfo { - name: "country_id", - col_type: Integer, - default: Some( - ColumnExpression( - "nextval(\'country_country_id_seq\'::regclass)", - ), + name: "return_date", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), + default: None, generated: None, not_null: None, }, ColumnInfo { - name: "country", - col_type: Unknown( - "character is unknown or unimplemented", - ), + name: "staff_id", + col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: Some( ColumnExpression( @@ -2135,16 +1330,30 @@ Schema { ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), + }, + ], + check_constraints: [ + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, }, - ], - check_constraints: [ Check { - expr: "country_id IS NOT NULL", + expr: "rental_date IS NOT NULL", no_inherit: false, }, Check { - expr: "country IS NOT NULL", + expr: "inventory_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", no_inherit: false, }, Check { @@ -2152,57 +1361,99 @@ Schema { no_inherit: false, }, ], - unique_keys: [], - references: [], + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "rental_id", + ], + ), + ], + reference_constraints: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "inventory_id", + ], + table: "inventory", + foreign_columns: [ + "inventory_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], + }, + ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "customer", + name: "staff", of_type: None, }, columns: [ ColumnInfo { - name: "customer_id", + name: "staff_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'customer_customer_id_seq\'::regclass)", + "nextval('staff_staff_id_seq'::regclass)", ), ), generated: None, - not_null: None, - }, - ColumnInfo { - name: "store_id", - col_type: SmallInt, - default: None, - generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "first_name", - col_type: Unknown( - "character is unknown or unimplemented", + col_type: Char( + StringAttr { + length: Some( + 45, + ), + }, ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "last_name", - col_type: Unknown( - "character is unknown or unimplemented", + col_type: Char( + StringAttr { + length: Some( + 45, + ), + }, ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "email", - col_type: Unknown( - "character is unknown or unimplemented", - ), + name: "address_id", + col_type: SmallInt, default: None, generated: None, not_null: Some( @@ -2210,42 +1461,76 @@ Schema { ), }, ColumnInfo { - name: "address_id", - col_type: SmallInt, + name: "email", + col_type: Char( + StringAttr { + length: Some( + 50, + ), + }, + ), default: None, generated: None, not_null: None, }, ColumnInfo { - name: "activebool", - col_type: Unknown( - "boolean is unknown or unimplemented", + name: "store_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: Some( + NotNull, ), + }, + ColumnInfo { + name: "active", + col_type: Boolean, default: Some( ColumnExpression( "true", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "create_date", - col_type: Unknown( - "date is unknown or unimplemented", + name: "username", + col_type: Char( + StringAttr { + length: Some( + 16, + ), + }, ), - default: Some( - ColumnExpression( - "(\'now\'::text)::date", - ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "password", + col_type: Char( + StringAttr { + length: Some( + 40, + ), + }, ), + default: None, generated: None, not_null: None, }, ColumnInfo { name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: Some( ColumnExpression( @@ -2258,22 +1543,20 @@ Schema { ), }, ColumnInfo { - name: "active", - col_type: Integer, + name: "picture", + col_type: Bytea, default: None, generated: None, - not_null: Some( - NotNull, - ), + not_null: None, }, ], check_constraints: [ Check { - expr: "customer_id IS NOT NULL", + expr: "last_update IS NOT NULL", no_inherit: false, }, Check { - expr: "store_id IS NOT NULL", + expr: "staff_id IS NOT NULL", no_inherit: false, }, Check { @@ -2289,16 +1572,28 @@ Schema { no_inherit: false, }, Check { - expr: "activebool IS NOT NULL", + expr: "store_id IS NOT NULL", no_inherit: false, }, Check { - expr: "create_date IS NOT NULL", + expr: "active IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "username IS NOT NULL", no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "staff_id", + ], + ), + ], + reference_constraints: [ References { columns: [ "address_id", @@ -2318,32 +1613,54 @@ Schema { ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "film_actor", + name: "store", of_type: None, }, columns: [ ColumnInfo { - name: "actor_id", + name: "store_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval('store_store_id_seq'::regclass)", + ), + ), + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "manager_staff_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "film_id", + name: "address_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: Some( ColumnExpression( @@ -2351,16 +1668,22 @@ Schema { ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "actor_id IS NOT NULL", + expr: "store_id IS NOT NULL", no_inherit: false, }, Check { - expr: "film_id IS NOT NULL", + expr: "manager_staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "address_id IS NOT NULL", no_inherit: false, }, Check { @@ -2368,289 +1691,515 @@ Schema { no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "store_id", + ], + ), + ], + reference_constraints: [ References { columns: [ - "actor_id", + "address_id", ], - table: "actor", + table: "address", foreign_columns: [ - "actor_id", + "address_id", ], }, References { columns: [ - "film_id", + "manager_staff_id", ], - table: "film", + table: "staff", foreign_columns: [ - "film_id", + "staff_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "film_category", + name: "payment", of_type: None, }, columns: [ ColumnInfo { - name: "film_id", + name: "payment_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval('payment_payment_id_seq'::regclass)", + ), + ), + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "customer_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "category_id", + name: "staff_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), - default: Some( - ColumnExpression( - "now()", - ), + name: "payment_date", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), + default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "film_id IS NOT NULL", + expr: "payment_id IS NOT NULL", no_inherit: false, }, Check { - expr: "category_id IS NOT NULL", + expr: "customer_id IS NOT NULL", no_inherit: false, }, Check { - expr: "last_update IS NOT NULL", + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [ + PrimaryKey( + [ + "payment_id", + ], + ), + ], + reference_constraints: [ References { columns: [ - "category_id", + "customer_id", ], - table: "category", + table: "customer", foreign_columns: [ - "category_id", + "customer_id", ], }, References { columns: [ - "film_id", + "rental_id", ], - table: "film", + table: "rental", foreign_columns: [ - "film_id", + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "inventory", + name: "payment_p2007_01", of_type: None, }, columns: [ ColumnInfo { - name: "inventory_id", + name: "payment_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'inventory_inventory_id_seq\'::regclass)", + "nextval('payment_payment_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "film_id", + name: "customer_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "store_id", + name: "staff_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: Some( + NotNull, ), - default: Some( - ColumnExpression( - "now()", - ), + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, ), + default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "payment_date", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "inventory_id IS NOT NULL", + expr: "payment_id IS NOT NULL", no_inherit: false, }, Check { - expr: "film_id IS NOT NULL", + expr: "customer_id IS NOT NULL", no_inherit: false, }, Check { - expr: "store_id IS NOT NULL", + expr: "staff_id IS NOT NULL", no_inherit: false, }, Check { - expr: "last_update IS NOT NULL", + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= '2007-01-01 00:00:00'::timestamp without time zone) AND (payment_date < '2007-02-01 00:00:00'::timestamp without time zone)))", no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [], + reference_constraints: [ References { columns: [ - "film_id", + "customer_id", ], - table: "film", + table: "customer", foreign_columns: [ - "film_id", + "customer_id", ], }, References { columns: [ - "store_id", + "rental_id", ], - table: "store", + table: "rental", foreign_columns: [ - "store_id", + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "language", + name: "payment_p2007_02", of_type: None, }, columns: [ ColumnInfo { - name: "language_id", + name: "payment_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'language_language_id_seq\'::regclass)", + "nextval('payment_payment_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "name", - col_type: Unknown( - "character is unknown or unimplemented", + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: Some( + NotNull, ), + }, + ColumnInfo { + name: "staff_id", + col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: Some( + NotNull, ), - default: Some( - ColumnExpression( - "now()", - ), + }, + ColumnInfo { + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, ), + default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "payment_date", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "language_id IS NOT NULL", + expr: "payment_id IS NOT NULL", no_inherit: false, }, Check { - expr: "name IS NOT NULL", + expr: "customer_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "staff_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= '2007-02-01 00:00:00'::timestamp without time zone) AND (payment_date < '2007-03-01 00:00:00'::timestamp without time zone)))", no_inherit: false, }, - Check { - expr: "last_update IS NOT NULL", - no_inherit: false, + ], + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [], + reference_constraints: [ + References { + columns: [ + "customer_id", + ], + table: "customer", + foreign_columns: [ + "customer_id", + ], + }, + References { + columns: [ + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", + ], }, ], - unique_keys: [], - references: [], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "rental", + name: "payment_p2007_03", of_type: None, }, columns: [ ColumnInfo { - name: "rental_id", + name: "payment_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'rental_rental_id_seq\'::regclass)", + "nextval('payment_payment_id_seq'::regclass)", ), ), generated: None, - not_null: None, - }, - ColumnInfo { - name: "rental_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", + not_null: Some( + NotNull, ), - default: None, - generated: None, - not_null: None, }, ColumnInfo { - name: "inventory_id", - col_type: Integer, + name: "customer_id", + col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "customer_id", + name: "staff_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "return_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), + name: "rental_id", + col_type: Integer, default: None, generated: None, not_null: Some( @@ -2658,54 +2207,73 @@ Schema { ), }, ColumnInfo { - name: "staff_id", - col_type: SmallInt, + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), - default: Some( - ColumnExpression( - "now()", - ), + name: "payment_date", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), + default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "rental_id IS NOT NULL", + expr: "payment_id IS NOT NULL", no_inherit: false, }, Check { - expr: "rental_date IS NOT NULL", + expr: "customer_id IS NOT NULL", no_inherit: false, }, Check { - expr: "inventory_id IS NOT NULL", + expr: "staff_id IS NOT NULL", no_inherit: false, }, Check { - expr: "customer_id IS NOT NULL", + expr: "rental_id IS NOT NULL", no_inherit: false, }, Check { - expr: "staff_id IS NOT NULL", + expr: "amount IS NOT NULL", no_inherit: false, }, Check { - expr: "last_update IS NOT NULL", + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= '2007-03-01 00:00:00'::timestamp without time zone) AND (payment_date < '2007-04-01 00:00:00'::timestamp without time zone)))", no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [], + reference_constraints: [ References { columns: [ "customer_id", @@ -2717,11 +2285,11 @@ Schema { }, References { columns: [ - "inventory_id", + "rental_id", ], - table: "inventory", + table: "rental", foreign_columns: [ - "inventory_id", + "rental_id", ], }, References { @@ -2734,94 +2302,66 @@ Schema { ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "staff", + name: "payment_p2007_04", of_type: None, }, columns: [ ColumnInfo { - name: "staff_id", + name: "payment_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'staff_staff_id_seq\'::regclass)", + "nextval('payment_payment_id_seq'::regclass)", ), ), generated: None, - not_null: None, - }, - ColumnInfo { - name: "first_name", - col_type: Unknown( - "character is unknown or unimplemented", - ), - default: None, - generated: None, - not_null: None, - }, - ColumnInfo { - name: "last_name", - col_type: Unknown( - "character is unknown or unimplemented", + not_null: Some( + NotNull, ), - default: None, - generated: None, - not_null: None, }, ColumnInfo { - name: "address_id", + name: "customer_id", col_type: SmallInt, default: None, generated: None, - not_null: None, - }, - ColumnInfo { - name: "email", - col_type: Unknown( - "character is unknown or unimplemented", - ), - default: None, - generated: None, not_null: Some( NotNull, ), }, ColumnInfo { - name: "store_id", + name: "staff_id", col_type: SmallInt, default: None, generated: None, - not_null: None, - }, - ColumnInfo { - name: "active", - col_type: Unknown( - "boolean is unknown or unimplemented", - ), - default: Some( - ColumnExpression( - "true", - ), + not_null: Some( + NotNull, ), - generated: None, - not_null: None, }, ColumnInfo { - name: "username", - col_type: Unknown( - "character is unknown or unimplemented", - ), + name: "rental_id", + col_type: Integer, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "password", - col_type: Unknown( - "character is unknown or unimplemented", + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, ), default: None, generated: None, @@ -2830,22 +2370,13 @@ Schema { ), }, ColumnInfo { - name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), - default: Some( - ColumnExpression( - "now()", - ), - ), - generated: None, - not_null: None, - }, - ColumnInfo { - name: "picture", - col_type: Unknown( - "bytea is unknown or unimplemented", + name: "payment_date", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: None, generated: None, @@ -2856,138 +2387,204 @@ Schema { ], check_constraints: [ Check { - expr: "last_update IS NOT NULL", - no_inherit: false, - }, - Check { - expr: "staff_id IS NOT NULL", + expr: "payment_id IS NOT NULL", no_inherit: false, }, Check { - expr: "first_name IS NOT NULL", + expr: "customer_id IS NOT NULL", no_inherit: false, }, Check { - expr: "last_name IS NOT NULL", + expr: "staff_id IS NOT NULL", no_inherit: false, }, Check { - expr: "address_id IS NOT NULL", + expr: "rental_id IS NOT NULL", no_inherit: false, }, Check { - expr: "store_id IS NOT NULL", + expr: "amount IS NOT NULL", no_inherit: false, }, Check { - expr: "active IS NOT NULL", + expr: "payment_date IS NOT NULL", no_inherit: false, }, Check { - expr: "username IS NOT NULL", + expr: "(((payment_date >= '2007-04-01 00:00:00'::timestamp without time zone) AND (payment_date < '2007-05-01 00:00:00'::timestamp without time zone)))", no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [], + reference_constraints: [ References { columns: [ - "address_id", + "customer_id", ], - table: "address", + table: "customer", foreign_columns: [ - "address_id", + "customer_id", ], }, References { columns: [ - "store_id", + "rental_id", ], - table: "store", + table: "rental", foreign_columns: [ - "store_id", + "rental_id", + ], + }, + References { + columns: [ + "staff_id", + ], + table: "staff", + foreign_columns: [ + "staff_id", ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "store", + name: "payment_p2007_05", of_type: None, }, columns: [ ColumnInfo { - name: "store_id", + name: "payment_id", col_type: Integer, default: Some( ColumnExpression( - "nextval(\'store_store_id_seq\'::regclass)", + "nextval('payment_payment_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "manager_staff_id", + name: "customer_id", + col_type: SmallInt, + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "staff_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "rental_id", + col_type: Integer, + default: None, + generated: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "address_id", - col_type: SmallInt, + name: "amount", + col_type: Numeric( + ArbitraryPrecisionNumericAttr { + precision: Some( + 5, + ), + scale: Some( + 2, + ), + }, + ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { - name: "last_update", - col_type: Unknown( - "timestamp is unknown or unimplemented", - ), - default: Some( - ColumnExpression( - "now()", - ), + name: "payment_date", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), + default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ Check { - expr: "store_id IS NOT NULL", + expr: "payment_id IS NOT NULL", no_inherit: false, }, Check { - expr: "manager_staff_id IS NOT NULL", + expr: "customer_id IS NOT NULL", no_inherit: false, }, Check { - expr: "address_id IS NOT NULL", + expr: "staff_id IS NOT NULL", no_inherit: false, }, Check { - expr: "last_update IS NOT NULL", + expr: "rental_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "amount IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "payment_date IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "(((payment_date >= '2007-05-01 00:00:00'::timestamp without time zone) AND (payment_date < '2007-06-01 00:00:00'::timestamp without time zone)))", no_inherit: false, }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [], + reference_constraints: [ References { columns: [ - "address_id", + "customer_id", ], - table: "address", + table: "customer", foreign_columns: [ - "address_id", + "customer_id", ], }, References { columns: [ - "manager_staff_id", + "rental_id", + ], + table: "rental", + foreign_columns: [ + "rental_id", + ], + }, + References { + columns: [ + "staff_id", ], table: "staff", foreign_columns: [ @@ -2995,11 +2592,12 @@ Schema { ], }, ], + exclusion_constraints: [], of_type: None, }, TableDef { info: TableInfo { - name: "payment", + name: "payment_p2007_06", of_type: None, }, columns: [ @@ -3008,32 +2606,40 @@ Schema { col_type: Integer, default: Some( ColumnExpression( - "nextval(\'payment_payment_id_seq\'::regclass)", + "nextval('payment_payment_id_seq'::regclass)", ), ), generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "customer_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "staff_id", col_type: SmallInt, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "rental_id", col_type: Integer, default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "amount", @@ -3049,16 +2655,24 @@ Schema { ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ColumnInfo { name: "payment_date", - col_type: Unknown( - "timestamp is unknown or unimplemented", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, ), default: None, generated: None, - not_null: None, + not_null: Some( + NotNull, + ), }, ], check_constraints: [ @@ -3086,9 +2700,15 @@ Schema { expr: "payment_date IS NOT NULL", no_inherit: false, }, + Check { + expr: "(((payment_date >= '2007-06-01 00:00:00'::timestamp without time zone) AND (payment_date < '2007-07-01 00:00:00'::timestamp without time zone)))", + no_inherit: false, + }, ], - unique_keys: [], - references: [ + not_null_constraints: [], + unique_constraints: [], + primary_key_constraints: [], + reference_constraints: [ References { columns: [ "customer_id", @@ -3117,6 +2737,209 @@ Schema { ], }, ], + exclusion_constraints: [], + of_type: None, + }, + TableDef { + info: TableInfo { + name: "actor", + of_type: None, + }, + columns: [ + ColumnInfo { + name: "actor_id", + col_type: Integer, + default: Some( + ColumnExpression( + "nextval('actor_actor_id_seq'::regclass)", + ), + ), + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "first_name", + col_type: Char( + StringAttr { + length: Some( + 45, + ), + }, + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "last_name", + col_type: Char( + StringAttr { + length: Some( + 45, + ), + }, + ), + default: None, + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "last_update", + col_type: Timestamp( + TimeAttr { + precision: Some( + 6, + ), + }, + ), + default: Some( + ColumnExpression( + "now()", + ), + ), + generated: None, + not_null: Some( + NotNull, + ), + }, + ColumnInfo { + name: "interval", + col_type: Interval( + IntervalAttr { + field: Some( + "DAY TO SECOND(2)", + ), + precision: None, + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "bit", + col_type: Bit( + BitAttr { + length: Some( + 20, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "bit_varying", + col_type: Bit( + BitAttr { + length: Some( + 10, + ), + }, + ), + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "ts_vector", + col_type: TsVector, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "ts_query", + col_type: TsQuery, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "uuid", + col_type: Uuid, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "xml", + col_type: Xml, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "json", + col_type: Json, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "array_int", + col_type: Array, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "array_int_int", + col_type: Array, + default: None, + generated: None, + not_null: None, + }, + ColumnInfo { + name: "pg_lsn", + col_type: PgLsn, + default: None, + generated: None, + not_null: None, + }, + ], + check_constraints: [ + Check { + expr: "actor_id IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "first_name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_name IS NOT NULL", + no_inherit: false, + }, + Check { + expr: "last_update IS NOT NULL", + no_inherit: false, + }, + ], + not_null_constraints: [], + unique_constraints: [ + Unique( + [ + "actor_id", + ], + ), + ], + primary_key_constraints: [ + PrimaryKey( + [ + "actor_id", + ], + ), + ], + reference_constraints: [], + exclusion_constraints: [], of_type: None, }, ], diff --git a/tests/writer/postgres/Cargo.toml b/tests/writer/postgres/Cargo.toml index c9a14b26..f48ab8d1 100644 --- a/tests/writer/postgres/Cargo.toml +++ b/tests/writer/postgres/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } -sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "writer" ] } +sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] } sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/writer/postgres/src/main.rs b/tests/writer/postgres/src/main.rs index 87d216a8..f3f228a3 100644 --- a/tests/writer/postgres/src/main.rs +++ b/tests/writer/postgres/src/main.rs @@ -12,6 +12,8 @@ async fn main() { let schema = schema_discovery.discover().await; + println!("{:#?}", schema); + for table in schema.tables.iter() { println!("{};", table.write().to_string(PostgresQueryBuilder)); println!(); From 7cad18c2a13b8f310bc7a713c68c0449b8987a91 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Mon, 2 Aug 2021 23:21:18 +0800 Subject: [PATCH 11/21] Writer & run generated SQL on live db --- src/postgres/def/schema.rs | 3 +- src/postgres/discovery/mod.rs | 1 - src/postgres/writer/column.rs | 193 ++++++++++++++++++++++------- src/postgres/writer/constraints.rs | 49 ++++++++ src/postgres/writer/table.rs | 18 +-- tests/discovery/postgres/schema.rs | 21 ---- tests/writer/postgres/src/main.rs | 37 +++++- 7 files changed, 239 insertions(+), 83 deletions(-) diff --git a/src/postgres/def/schema.rs b/src/postgres/def/schema.rs index c5e9ec09..7deb063a 100644 --- a/src/postgres/def/schema.rs +++ b/src/postgres/def/schema.rs @@ -22,9 +22,8 @@ pub struct TableDef { pub primary_key_constraints: Vec, pub reference_constraints: Vec, pub exclusion_constraints: Vec, - // FIXME: Duplication? TableInfo also have of_type - pub of_type: Option, + // pub of_type: Option, // TODO: // pub inherets: Vec, } diff --git a/src/postgres/discovery/mod.rs b/src/postgres/discovery/mod.rs index 9d4fc0df..ea673e33 100644 --- a/src/postgres/discovery/mod.rs +++ b/src/postgres/discovery/mod.rs @@ -120,7 +120,6 @@ impl SchemaDiscovery { primary_key_constraints, reference_constraints, exclusion_constraints, - of_type: None, } } diff --git a/src/postgres/writer/column.rs b/src/postgres/writer/column.rs index 60f81aaa..931c4fcb 100644 --- a/src/postgres/writer/column.rs +++ b/src/postgres/writer/column.rs @@ -10,23 +10,12 @@ impl ColumnInfo { if self.not_null.is_some() { col_def = col_def.not_null(); } - // if self.extra.auto_increment { - // col_def = col_def.auto_increment(); - // } let mut extras = Vec::new(); if let Some(default) = self.default.as_ref() { let mut string = "".to_owned(); write!(&mut string, "DEFAULT {}", default.0).unwrap(); extras.push(string); } - // if self.extra.on_update_current_timestamp { - // extras.push("ON UPDATE CURRENT_TIMESTAMP".to_owned()); - // } - // if !self.comment.is_empty() { - // let mut string = "".to_owned(); - // write!(&mut string, "COMMENT '{}'", escape_string(&self.comment)).unwrap(); - // extras.push(string); - // } if !extras.is_empty() { col_def = col_def.extra(extras.join(" ")); } @@ -54,7 +43,19 @@ impl ColumnInfo { ); } } - Type::Numeric(num_attr) => {} + Type::Numeric(num_attr) => { + col_def = col_def.extra("numeric".to_owned()); + if num_attr.precision.is_some() { + col_def = col_def.extra("(".to_owned()); + if let Some(precision) = num_attr.precision { + col_def = col_def.extra(format!("{}", precision)); + } + if let Some(scale) = num_attr.scale { + col_def = col_def.extra(format!(", {}", scale)); + } + col_def = col_def.extra(")".to_owned()); + } + } Type::Real => { col_def = col_def.float(); } @@ -73,42 +74,138 @@ impl ColumnInfo { Type::Money => { col_def = col_def.money(); } - Type::Varchar(string_att) => {} - Type::Char(string_att) => {} - Type::Text => {} - Type::Bytea => {} - Type::Timestamp(time_att) => {} - Type::TimestampWithTimeZone(time_att) => {} - Type::Date => {} - Type::Time(time_att) => {} - Type::TimeWithTimeZone(time_att) => {} - Type::Interval(time_att) => {} - Type::Boolean => {} - Type::Point => {} - Type::Line => {} - Type::Lseg => {} - Type::Box => {} - Type::Path => {} - Type::Polygon => {} - Type::Circle => {} - Type::Cidr => {} - Type::Inet => {} - Type::MacAddr => {} - Type::MacAddr8 => {} - Type::Bit(bit_attr) => {} - Type::TsVector => {} - Type::TsQuery => {} - Type::Uuid => {} - Type::Xml => {} - Type::Json => {} - Type::Array => {} - Type::Int4Range => {} - Type::Int8Range => {} - Type::NumRange => {} - Type::TsRange => {} - Type::TsTzRange => {} - Type::DateRange => {} - Type::PgLsn => {} + Type::Varchar(string_attr) => { + col_def = match string_attr.length { + Some(length) => col_def.string_len(length.into()), + None => col_def.string(), + }; + } + Type::Char(string_attr) => { + col_def = match string_attr.length { + Some(length) => col_def.char_len(length.into()), + None => col_def.char(), + }; + } + Type::Text => { + col_def = col_def.text(); + } + Type::Bytea => { + // col_def = col_def.binary(); + col_def = col_def.extra("bytea".to_owned()); + } + Type::Timestamp(time_attr) => { + col_def = match time_attr.precision { + Some(precision) => col_def.timestamp_len(precision.into()), + None => col_def.timestamp(), + }; + } + Type::TimestampWithTimeZone(time_attr) => { + col_def = match time_attr.precision { + Some(precision) => col_def.timestamp_len(precision.into()), + None => col_def.timestamp(), + }; + } + Type::Date => { + col_def = col_def.date(); + } + Type::Time(time_attr) => { + col_def = match time_attr.precision { + Some(precision) => col_def.time_len(precision.into()), + None => col_def.time(), + }; + } + Type::TimeWithTimeZone(time_attr) => { + col_def = match time_attr.precision { + Some(precision) => col_def.time_len(precision.into()), + None => col_def.time(), + }; + } + Type::Interval(time_attr) => {} + Type::Boolean => { + col_def = col_def.boolean(); + } + Type::Point => { + col_def = col_def.extra("point".to_owned()); + } + Type::Line => { + col_def = col_def.extra("line".to_owned()); + } + Type::Lseg => { + col_def = col_def.extra("lseg".to_owned()); + } + Type::Box => { + col_def = col_def.extra("box".to_owned()); + } + Type::Path => { + col_def = col_def.extra("path".to_owned()); + } + Type::Polygon => { + col_def = col_def.extra("ploygon".to_owned()); + } + Type::Circle => { + col_def = col_def.extra("circle".to_owned()); + } + Type::Cidr => { + col_def = col_def.extra("cidr".to_owned()); + } + Type::Inet => { + col_def = col_def.extra("inet".to_owned()); + } + Type::MacAddr => { + col_def = col_def.extra("macaddr".to_owned()); + } + Type::MacAddr8 => { + col_def = col_def.extra("macaddr8".to_owned()); + } + Type::Bit(bit_attr) => { + col_def = col_def.extra("bit".to_owned()); + if bit_attr.length.is_some() { + col_def = col_def.extra("(".to_owned()); + if let Some(length) = bit_attr.length { + col_def = col_def.extra(format!("{}", length)); + } + col_def = col_def.extra(")".to_owned()); + } + } + Type::TsVector => { + col_def = col_def.extra("tsvector".to_owned()); + } + Type::TsQuery => { + col_def = col_def.extra("tsquery".to_owned()); + } + Type::Uuid => { + col_def = col_def.extra("uuid".to_owned()); + } + Type::Xml => { + col_def = col_def.extra("xml".to_owned()); + } + Type::Json => { + col_def = col_def.extra("json".to_owned()); + } + Type::Array => { + col_def = col_def.extra("array".to_owned()); + } + Type::Int4Range => { + col_def = col_def.extra("int4range".to_owned()); + } + Type::Int8Range => { + col_def = col_def.extra("int8range".to_owned()); + } + Type::NumRange => { + col_def = col_def.extra("numrange".to_owned()); + } + Type::TsRange => { + col_def = col_def.extra("tsrange".to_owned()); + } + Type::TsTzRange => { + col_def = col_def.extra("tstzrange".to_owned()); + } + Type::DateRange => { + col_def = col_def.extra("daterange".to_owned()); + } + Type::PgLsn => { + col_def = col_def.extra("pg_lsn".to_owned()); + } Type::Unknown(s) => { col_def = col_def.custom(Alias::new(s)); } diff --git a/src/postgres/writer/constraints.rs b/src/postgres/writer/constraints.rs index 8b137891..b1fb4673 100644 --- a/src/postgres/writer/constraints.rs +++ b/src/postgres/writer/constraints.rs @@ -1 +1,50 @@ +use crate::postgres::def::{PrimaryKey, References, Unique}; +use sea_query::{Alias, ForeignKey, ForeignKeyCreateStatement, Index, IndexCreateStatement}; +impl PrimaryKey { + pub fn write(&self) -> IndexCreateStatement { + let mut idx = Index::create().primary(); + for col in self.0.iter() { + idx = idx.col(Alias::new(col)); + } + idx + } +} + +impl Unique { + pub fn write(&self) -> IndexCreateStatement { + let mut idx = Index::create().unique(); + for col in self.0.iter() { + idx = idx.col(Alias::new(col)); + } + idx + } +} + +impl References { + pub fn write(&self) -> ForeignKeyCreateStatement { + let mut key = ForeignKey::create(); + key = key.to_tbl(Alias::new(&self.table)); + for column in self.columns.iter() { + key = key.from_col(Alias::new(&column)); + } + for ref_col in self.foreign_columns.iter() { + key = key.to_col(Alias::new(&ref_col)); + } + // key = key.on_update(match self.on_update { + // ForeignKeyAction::Cascade => sea_query::ForeignKeyAction::Cascade, + // ForeignKeyAction::SetNull => sea_query::ForeignKeyAction::SetNull, + // ForeignKeyAction::SetDefault => sea_query::ForeignKeyAction::SetDefault, + // ForeignKeyAction::Restrict => sea_query::ForeignKeyAction::Restrict, + // ForeignKeyAction::NoAction => sea_query::ForeignKeyAction::NoAction, + // }); + // key = key.on_delete(match self.on_delete { + // ForeignKeyAction::Cascade => sea_query::ForeignKeyAction::Cascade, + // ForeignKeyAction::SetNull => sea_query::ForeignKeyAction::SetNull, + // ForeignKeyAction::SetDefault => sea_query::ForeignKeyAction::SetDefault, + // ForeignKeyAction::Restrict => sea_query::ForeignKeyAction::Restrict, + // ForeignKeyAction::NoAction => sea_query::ForeignKeyAction::NoAction, + // }); + key + } +} diff --git a/src/postgres/writer/table.rs b/src/postgres/writer/table.rs index 0bb94233..b143cba6 100644 --- a/src/postgres/writer/table.rs +++ b/src/postgres/writer/table.rs @@ -8,15 +8,15 @@ impl TableDef { for col in self.columns.iter() { table.col(col.write()); } - // table.engine(self.info.engine.to_string().as_str()); - // table.character_set(self.info.char_set.to_string().as_str()); - // table.collate(self.info.collation.to_string().as_str()); - // for idx in self.indexes.iter() { - // table.index(idx.write()); - // } - // for key in self.foreign_keys.iter() { - // table.foreign_key(key.write()); - // } + for primary_key in self.primary_key_constraints.iter() { + table.primary_key(primary_key.write()); + } + for unique in self.unique_constraints.iter() { + table.index(unique.write()); + } + for reference in self.reference_constraints.iter() { + table.foreign_key(reference.write()); + } TableStatement::Create(table) } } diff --git a/tests/discovery/postgres/schema.rs b/tests/discovery/postgres/schema.rs index b3ecbc8b..a422fac8 100644 --- a/tests/discovery/postgres/schema.rs +++ b/tests/discovery/postgres/schema.rs @@ -242,7 +242,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -410,7 +409,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -491,7 +489,6 @@ Schema { ], reference_constraints: [], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -595,7 +592,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -676,7 +672,6 @@ Schema { ], reference_constraints: [], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -869,7 +864,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -960,7 +954,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -1051,7 +1044,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -1158,7 +1150,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -1239,7 +1230,6 @@ Schema { ], reference_constraints: [], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -1400,7 +1390,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -1614,7 +1603,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -1721,7 +1709,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -1868,7 +1855,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -2013,7 +1999,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -2158,7 +2143,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -2303,7 +2287,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -2448,7 +2431,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -2593,7 +2575,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -2738,7 +2719,6 @@ Schema { }, ], exclusion_constraints: [], - of_type: None, }, TableDef { info: TableInfo { @@ -2940,7 +2920,6 @@ Schema { ], reference_constraints: [], exclusion_constraints: [], - of_type: None, }, ], } diff --git a/tests/writer/postgres/src/main.rs b/tests/writer/postgres/src/main.rs index f3f228a3..2d7cc708 100644 --- a/tests/writer/postgres/src/main.rs +++ b/tests/writer/postgres/src/main.rs @@ -1,6 +1,6 @@ use sea_query::PostgresQueryBuilder; use sea_schema::postgres::discovery::SchemaDiscovery; -use sqlx::PgPool; +use sqlx::{Executor, PgPool, Pool, Postgres}; #[async_std::main] async fn main() { @@ -14,8 +14,41 @@ async fn main() { println!("{:#?}", schema); + let mut connection = setup("postgres://sea:sea@localhost", "sakila_test") + .await + .acquire() + .await + .unwrap(); + for table in schema.tables.iter() { - println!("{};", table.write().to_string(PostgresQueryBuilder)); + let sql = table.write().to_string(PostgresQueryBuilder); + let sql = sql.replace("UNIQUE KEY", "UNIQUE"); + println!("{};", sql); println!(); + sqlx::query(&sql).execute(&mut connection).await.unwrap(); } } + +pub async fn setup(base_url: &str, db_name: &str) -> Pool { + let url = format!("{}/postgres", base_url); + let mut connection = PgPool::connect(&url) + .await + .unwrap() + .acquire() + .await + .unwrap(); + + let _drop_db_result = sqlx::query(&format!("DROP DATABASE IF EXISTS \"{}\";", db_name)) + .bind(db_name) + .execute(&mut connection) + .await + .unwrap(); + + let _create_db_result = sqlx::query(&format!("CREATE DATABASE \"{}\";", db_name)) + .execute(&mut connection) + .await + .unwrap(); + + let url = format!("{}/{}", base_url, db_name); + PgPool::connect(&url).await.unwrap() +} From 7e6e5f10d3d7d4c9ee34cb7da20137f5df8a90d2 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 13:15:39 +0800 Subject: [PATCH 12/21] Test on live Postgres db --- .github/workflows/rust.yml | 59 +++++++++-- Cargo.toml | 1 + src/postgres/writer/column.rs | 47 +++++---- tests/live/postgres/Cargo.toml | 12 +++ tests/live/postgres/Readme.md | 5 + tests/live/postgres/src/main.rs | 170 ++++++++++++++++++++++++++++++ tests/writer/postgres/src/main.rs | 37 +------ 7 files changed, 262 insertions(+), 69 deletions(-) create mode 100644 tests/live/postgres/Cargo.toml create mode 100644 tests/live/postgres/Readme.md create mode 100644 tests/live/postgres/src/main.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a94a83e3..3e6f5962 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,22 +1,59 @@ -name: Rust +name: sea-schema on: push: - branches: [ master ] + branches: + - master pull_request: - branches: [ master ] + branches: + - master env: CARGO_TERM_COLOR: always jobs: - build: - + test: + name: Unit Test runs-on: ubuntu-20.04 - + services: + postgres: + image: postgres:11 + env: + POSTGRES_HOST: 127.0.0.1 + POSTGRES_USER: sea + POSTGRES_PASSWORD: sea + ports: + - "5432:5432" + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - - uses: actions/checkout@v2 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }} + + - uses: actions-rs/cargo@v1 + with: + command: build + args: > + --all + + - uses: actions-rs/cargo@v1 + with: + command: test + args: > + --all diff --git a/Cargo.toml b/Cargo.toml index 8f395aa5..59babacd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ members = [ "tests/discovery/postgres", "tests/writer/mysql", "tests/writer/postgres", + "tests/live/postgres", ] [package] diff --git a/src/postgres/writer/column.rs b/src/postgres/writer/column.rs index 931c4fcb..68813193 100644 --- a/src/postgres/writer/column.rs +++ b/src/postgres/writer/column.rs @@ -1,21 +1,37 @@ use crate::postgres::def::{ArbitraryPrecisionNumericAttr, ColumnInfo, Type}; use core::num; use sea_query::{escape_string, Alias, ColumnDef, Iden}; -use std::fmt::Write; +use std::{default, fmt::Write}; impl ColumnInfo { pub fn write(&self) -> ColumnDef { + let mut self_copy = self.clone(); let mut col_def = ColumnDef::new(Alias::new(self.name.as_str())); - col_def = self.write_col_type(col_def); + let mut extras: Vec = Vec::new(); + if let Some(default) = self.default.as_ref() { + if default.0.starts_with("nextval") { + match self.col_type { + Type::SmallInt => { + self_copy.col_type = Type::SmallSerial; + } + Type::Integer => { + self_copy.col_type = Type::Serial; + } + Type::BigInt => { + self_copy.col_type = Type::BigSerial; + } + _ => {} + } + } else { + let mut string = "".to_owned(); + write!(&mut string, "DEFAULT {}", default.0).unwrap(); + extras.push(string); + } + } + col_def = self_copy.write_col_type(col_def); if self.not_null.is_some() { col_def = col_def.not_null(); } - let mut extras = Vec::new(); - if let Some(default) = self.default.as_ref() { - let mut string = "".to_owned(); - write!(&mut string, "DEFAULT {}", default.0).unwrap(); - extras.push(string); - } if !extras.is_empty() { col_def = col_def.extra(extras.join(" ")); } @@ -33,7 +49,7 @@ impl ColumnInfo { Type::BigInt => { col_def = col_def.big_integer(); } - Type::Decimal(num_attr) => { + Type::Decimal(num_attr) | Type::Numeric(num_attr) => { if num_attr.precision.is_none() & num_attr.scale.is_none() { col_def = col_def.decimal(); } else { @@ -43,19 +59,6 @@ impl ColumnInfo { ); } } - Type::Numeric(num_attr) => { - col_def = col_def.extra("numeric".to_owned()); - if num_attr.precision.is_some() { - col_def = col_def.extra("(".to_owned()); - if let Some(precision) = num_attr.precision { - col_def = col_def.extra(format!("{}", precision)); - } - if let Some(scale) = num_attr.scale { - col_def = col_def.extra(format!(", {}", scale)); - } - col_def = col_def.extra(")".to_owned()); - } - } Type::Real => { col_def = col_def.float(); } diff --git a/tests/live/postgres/Cargo.toml b/tests/live/postgres/Cargo.toml new file mode 100644 index 00000000..aa35a9d3 --- /dev/null +++ b/tests/live/postgres/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "sea-schema-live-test-postgres" +version = "0.1.0" +edition = "2018" +publish = false + +[dependencies] +async-std = { version = "1.8", features = [ "attributes" ] } +sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] } +sea-query = { version = "^0.12" } +serde_json = { version = "^1" } +sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/live/postgres/Readme.md b/tests/live/postgres/Readme.md new file mode 100644 index 00000000..6946a346 --- /dev/null +++ b/tests/live/postgres/Readme.md @@ -0,0 +1,5 @@ +# Run + +```sh +cargo run > schema.sql +``` \ No newline at end of file diff --git a/tests/live/postgres/src/main.rs b/tests/live/postgres/src/main.rs new file mode 100644 index 00000000..162df6a2 --- /dev/null +++ b/tests/live/postgres/src/main.rs @@ -0,0 +1,170 @@ +use std::collections::HashMap; + +use sea_query::{ + Alias, ColumnDef, ForeignKey, Index, PostgresQueryBuilder, Table, TableCreateStatement, +}; +use sea_schema::postgres::{def::TableDef, discovery::SchemaDiscovery}; +use sqlx::{Executor, PgPool, Pool, Postgres}; + +#[cfg_attr(test, async_std::test)] +#[cfg_attr(not(test), async_std::main)] +async fn main() { + let mut connection = setup("postgres://sea:sea@localhost", "sea-schema").await; + let mut executor = connection.acquire().await.unwrap(); + + let tables = vec![ + ("actor", create_actor_table()), + ("film", create_film_table()), + ("film_actor", create_film_actor_table()), + ]; + + for (_, tbl_create_stmt) in tables.iter() { + let sql = tbl_create_stmt.to_string(PostgresQueryBuilder); + let sql = replace_sql(sql); + println!("{};", sql); + println!(); + sqlx::query(&sql).execute(&mut executor).await.unwrap(); + } + + let schema_discovery = SchemaDiscovery::new(connection, "public"); + + let schema = schema_discovery.discover().await; + + let map: HashMap = schema + .tables + .iter() + .map(|table| (table.info.name.clone(), table.clone())) + .collect(); + + for (table, tbl_create_stmt) in tables.into_iter() { + let expected_sql = tbl_create_stmt.to_string(PostgresQueryBuilder); + let expected_sql = replace_sql(expected_sql); + let table = map.get(table).unwrap(); + let sql = table.write().to_string(PostgresQueryBuilder); + let sql = replace_sql(sql); + println!("Expected SQL:"); + println!("{};", expected_sql); + println!("Generated SQL:"); + println!("{};", sql); + println!(); + assert_eq!(expected_sql, sql); + } +} + +pub fn replace_sql(sql: String) -> String { + sql.replace("UNIQUE KEY", "UNIQUE") + .replace("CONSTRAINT FOREIGN KEY", "FOREIGN KEY") +} + +pub async fn setup(base_url: &str, db_name: &str) -> Pool { + let url = format!("{}/postgres", base_url); + let mut connection = PgPool::connect(&url) + .await + .unwrap() + .acquire() + .await + .unwrap(); + + let _drop_db_result = sqlx::query(&format!("DROP DATABASE IF EXISTS \"{}\";", db_name)) + .bind(db_name) + .execute(&mut connection) + .await + .unwrap(); + + let _create_db_result = sqlx::query(&format!("CREATE DATABASE \"{}\";", db_name)) + .execute(&mut connection) + .await + .unwrap(); + + let url = format!("{}/{}", base_url, db_name); + PgPool::connect(&url).await.unwrap() +} + +pub fn create_actor_table() -> TableCreateStatement { + Table::create() + .table(Alias::new("actor")) + .col( + ColumnDef::new(Alias::new("actor_id")) + .integer() + .auto_increment() + .not_null(), + ) + .col( + ColumnDef::new(Alias::new("first_name")) + .char_len(45) + .not_null(), + ) + .col( + ColumnDef::new(Alias::new("last_name")) + .char_len(45) + .not_null(), + ) + .col( + ColumnDef::new(Alias::new("last_update")) + .timestamp_len(6) + .not_null() + .extra("DEFAULT now()".to_owned()), + ) + .primary_key(Index::create().primary().col(Alias::new("actor_id"))) + .to_owned() +} + +pub fn create_film_table() -> TableCreateStatement { + Table::create() + .table(Alias::new("film")) + .col( + ColumnDef::new(Alias::new("film_id")) + .integer() + .auto_increment() + .not_null(), + ) + .col(ColumnDef::new(Alias::new("title")).char_len(255).not_null()) + .col(ColumnDef::new(Alias::new("description")).text()) + .col( + ColumnDef::new(Alias::new("rental_rate")) + .decimal_len(4, 2) + .not_null() + .default(4.99), + ) + .col( + ColumnDef::new(Alias::new("last_update")) + .timestamp_len(6) + .not_null() + .extra("DEFAULT now()".to_owned()), + ) + .primary_key(Index::create().primary().col(Alias::new("film_id"))) + .index(Index::create().unique().col(Alias::new("title"))) + .to_owned() +} + +pub fn create_film_actor_table() -> TableCreateStatement { + Table::create() + .table(Alias::new("film_actor")) + .col(ColumnDef::new(Alias::new("actor_id")).integer().not_null()) + .col(ColumnDef::new(Alias::new("film_id")).integer().not_null()) + .col( + ColumnDef::new(Alias::new("last_update")) + .timestamp_len(6) + .not_null() + .extra("DEFAULT now()".to_owned()), + ) + .primary_key( + Index::create() + .primary() + .col(Alias::new("actor_id")) + .col(Alias::new("film_id")), + ) + .foreign_key( + ForeignKey::create() + .to_tbl(Alias::new("actor")) + .from_col(Alias::new("actor_id")) + .to_col(Alias::new("actor_id")), + ) + .foreign_key( + ForeignKey::create() + .to_tbl(Alias::new("film")) + .from_col(Alias::new("film_id")) + .to_col(Alias::new("film_id")), + ) + .to_owned() +} diff --git a/tests/writer/postgres/src/main.rs b/tests/writer/postgres/src/main.rs index 2d7cc708..396954de 100644 --- a/tests/writer/postgres/src/main.rs +++ b/tests/writer/postgres/src/main.rs @@ -12,43 +12,8 @@ async fn main() { let schema = schema_discovery.discover().await; - println!("{:#?}", schema); - - let mut connection = setup("postgres://sea:sea@localhost", "sakila_test") - .await - .acquire() - .await - .unwrap(); - for table in schema.tables.iter() { - let sql = table.write().to_string(PostgresQueryBuilder); - let sql = sql.replace("UNIQUE KEY", "UNIQUE"); - println!("{};", sql); + println!("{};", table.write().to_string(PostgresQueryBuilder)); println!(); - sqlx::query(&sql).execute(&mut connection).await.unwrap(); } } - -pub async fn setup(base_url: &str, db_name: &str) -> Pool { - let url = format!("{}/postgres", base_url); - let mut connection = PgPool::connect(&url) - .await - .unwrap() - .acquire() - .await - .unwrap(); - - let _drop_db_result = sqlx::query(&format!("DROP DATABASE IF EXISTS \"{}\";", db_name)) - .bind(db_name) - .execute(&mut connection) - .await - .unwrap(); - - let _create_db_result = sqlx::query(&format!("CREATE DATABASE \"{}\";", db_name)) - .execute(&mut connection) - .await - .unwrap(); - - let url = format!("{}/{}", base_url, db_name); - PgPool::connect(&url).await.unwrap() -} From 10c6ddbaf59402846b1bcb95f5afc46d25a23a44 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 14:47:12 +0800 Subject: [PATCH 13/21] Fix pg keyword issue on sea-query --- tests/live/postgres/src/main.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/live/postgres/src/main.rs b/tests/live/postgres/src/main.rs index 162df6a2..d31b65dd 100644 --- a/tests/live/postgres/src/main.rs +++ b/tests/live/postgres/src/main.rs @@ -20,7 +20,6 @@ async fn main() { for (_, tbl_create_stmt) in tables.iter() { let sql = tbl_create_stmt.to_string(PostgresQueryBuilder); - let sql = replace_sql(sql); println!("{};", sql); println!(); sqlx::query(&sql).execute(&mut executor).await.unwrap(); @@ -38,10 +37,8 @@ async fn main() { for (table, tbl_create_stmt) in tables.into_iter() { let expected_sql = tbl_create_stmt.to_string(PostgresQueryBuilder); - let expected_sql = replace_sql(expected_sql); let table = map.get(table).unwrap(); let sql = table.write().to_string(PostgresQueryBuilder); - let sql = replace_sql(sql); println!("Expected SQL:"); println!("{};", expected_sql); println!("Generated SQL:"); @@ -51,11 +48,6 @@ async fn main() { } } -pub fn replace_sql(sql: String) -> String { - sql.replace("UNIQUE KEY", "UNIQUE") - .replace("CONSTRAINT FOREIGN KEY", "FOREIGN KEY") -} - pub async fn setup(base_url: &str, db_name: &str) -> Pool { let url = format!("{}/postgres", base_url); let mut connection = PgPool::connect(&url) From e284b5b72c098f3afab5600f848245fa28127927 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 14:51:00 +0800 Subject: [PATCH 14/21] Use SeaQL/sea-query#85 & re-export sea-query --- Cargo.toml | 2 +- src/lib.rs | 2 ++ tests/discovery/mysql/Cargo.toml | 1 - tests/discovery/postgres/Cargo.toml | 1 - tests/live/postgres/Cargo.toml | 1 - tests/live/postgres/src/main.rs | 2 +- tests/writer/mysql/Cargo.toml | 1 - tests/writer/mysql/src/main.rs | 2 +- tests/writer/postgres/Cargo.toml | 1 - tests/writer/postgres/src/main.rs | 2 +- 10 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 59babacd..8f4bf943 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ path = "src/lib.rs" [dependencies] futures = { version = "0.3", optional = true } sea-schema-derive = { version = "0.1.0", path = "sea-schema-derive" } -sea-query = { version = "^0.12" } +sea-query = { version = "^0.12", git = "https://github.com/SeaQL/sea-query.git", branch = "fix-pg-constraints" } serde = { version = "^1", features = ["derive"], optional = true } sqlx = { version = "^0", optional = true } diff --git a/src/lib.rs b/src/lib.rs index c77ff641..7269f14f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,8 @@ pub mod mysql; #[cfg_attr(docsrs, doc(cfg(feature = "postgres")))] pub mod postgres; +pub use sea_query; + pub(crate) mod parser; pub(crate) mod sqlx_types; pub(crate) mod util; diff --git a/tests/discovery/mysql/Cargo.toml b/tests/discovery/mysql/Cargo.toml index 9f782c81..5fb9dfe2 100644 --- a/tests/discovery/mysql/Cargo.toml +++ b/tests/discovery/mysql/Cargo.toml @@ -7,6 +7,5 @@ publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-mysql", "runtime-async-std-native-tls", "discovery" ] } -sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/discovery/postgres/Cargo.toml b/tests/discovery/postgres/Cargo.toml index 738723a5..e730a51a 100644 --- a/tests/discovery/postgres/Cargo.toml +++ b/tests/discovery/postgres/Cargo.toml @@ -7,6 +7,5 @@ publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } sea-schema = { path = "../../../", default-features = false, features = [ "with-serde", "sqlx-postgres", "runtime-async-std-native-tls", "discovery" ] } -sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/live/postgres/Cargo.toml b/tests/live/postgres/Cargo.toml index aa35a9d3..7fffd599 100644 --- a/tests/live/postgres/Cargo.toml +++ b/tests/live/postgres/Cargo.toml @@ -7,6 +7,5 @@ publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] } -sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/live/postgres/src/main.rs b/tests/live/postgres/src/main.rs index d31b65dd..76c0adfc 100644 --- a/tests/live/postgres/src/main.rs +++ b/tests/live/postgres/src/main.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use sea_query::{ +use sea_schema::sea_query::{ Alias, ColumnDef, ForeignKey, Index, PostgresQueryBuilder, Table, TableCreateStatement, }; use sea_schema::postgres::{def::TableDef, discovery::SchemaDiscovery}; diff --git a/tests/writer/mysql/Cargo.toml b/tests/writer/mysql/Cargo.toml index 96f3007b..0164c066 100644 --- a/tests/writer/mysql/Cargo.toml +++ b/tests/writer/mysql/Cargo.toml @@ -7,6 +7,5 @@ publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-mysql", "runtime-async-std-native-tls", "discovery", "writer" ] } -sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/writer/mysql/src/main.rs b/tests/writer/mysql/src/main.rs index 1735c729..20fde248 100644 --- a/tests/writer/mysql/src/main.rs +++ b/tests/writer/mysql/src/main.rs @@ -1,4 +1,4 @@ -use sea_query::MysqlQueryBuilder; +use sea_schema::sea_query::MysqlQueryBuilder; use sea_schema::mysql::discovery::SchemaDiscovery; use sqlx::MySqlPool; diff --git a/tests/writer/postgres/Cargo.toml b/tests/writer/postgres/Cargo.toml index f48ab8d1..a799aa5d 100644 --- a/tests/writer/postgres/Cargo.toml +++ b/tests/writer/postgres/Cargo.toml @@ -7,6 +7,5 @@ publish = false [dependencies] async-std = { version = "1.8", features = [ "attributes" ] } sea-schema = { path = "../../../", default-features = false, features = [ "sqlx-postgres", "runtime-async-std-native-tls", "discovery", "writer", "debug-print" ] } -sea-query = { version = "^0.12" } serde_json = { version = "^1" } sqlx = { version = "^0" } \ No newline at end of file diff --git a/tests/writer/postgres/src/main.rs b/tests/writer/postgres/src/main.rs index 396954de..c5bc70fc 100644 --- a/tests/writer/postgres/src/main.rs +++ b/tests/writer/postgres/src/main.rs @@ -1,4 +1,4 @@ -use sea_query::PostgresQueryBuilder; +use sea_schema::sea_query::PostgresQueryBuilder; use sea_schema::postgres::discovery::SchemaDiscovery; use sqlx::{Executor, PgPool, Pool, Postgres}; From 8ca21cd9a1d6586a7f7b8e3da7545119783bbf04 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 15:01:03 +0800 Subject: [PATCH 15/21] Update README --- tests/live/postgres/Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/live/postgres/Readme.md b/tests/live/postgres/Readme.md index 6946a346..f42d5d6c 100644 --- a/tests/live/postgres/Readme.md +++ b/tests/live/postgres/Readme.md @@ -1,5 +1,5 @@ # Run ```sh -cargo run > schema.sql +cargo run ``` \ No newline at end of file From d948089a43a579b164934d354318ce1b8d976e85 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 15:55:19 +0800 Subject: [PATCH 16/21] cargo fmt --- tests/live/postgres/src/main.rs | 2 +- tests/writer/mysql/src/main.rs | 2 +- tests/writer/postgres/src/main.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/live/postgres/src/main.rs b/tests/live/postgres/src/main.rs index 76c0adfc..c8bdd214 100644 --- a/tests/live/postgres/src/main.rs +++ b/tests/live/postgres/src/main.rs @@ -1,9 +1,9 @@ use std::collections::HashMap; +use sea_schema::postgres::{def::TableDef, discovery::SchemaDiscovery}; use sea_schema::sea_query::{ Alias, ColumnDef, ForeignKey, Index, PostgresQueryBuilder, Table, TableCreateStatement, }; -use sea_schema::postgres::{def::TableDef, discovery::SchemaDiscovery}; use sqlx::{Executor, PgPool, Pool, Postgres}; #[cfg_attr(test, async_std::test)] diff --git a/tests/writer/mysql/src/main.rs b/tests/writer/mysql/src/main.rs index 20fde248..aa90bbcf 100644 --- a/tests/writer/mysql/src/main.rs +++ b/tests/writer/mysql/src/main.rs @@ -1,5 +1,5 @@ -use sea_schema::sea_query::MysqlQueryBuilder; use sea_schema::mysql::discovery::SchemaDiscovery; +use sea_schema::sea_query::MysqlQueryBuilder; use sqlx::MySqlPool; #[async_std::main] diff --git a/tests/writer/postgres/src/main.rs b/tests/writer/postgres/src/main.rs index c5bc70fc..d1472a34 100644 --- a/tests/writer/postgres/src/main.rs +++ b/tests/writer/postgres/src/main.rs @@ -1,5 +1,5 @@ -use sea_schema::sea_query::PostgresQueryBuilder; use sea_schema::postgres::discovery::SchemaDiscovery; +use sea_schema::sea_query::PostgresQueryBuilder; use sqlx::{Executor, PgPool, Pool, Postgres}; #[async_std::main] From 6bd08c77619eebe0ac9a175907f34c376c3f04db Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 15:56:02 +0800 Subject: [PATCH 17/21] Hotfix column type mappings --- src/postgres/writer/column.rs | 61 ++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/postgres/writer/column.rs b/src/postgres/writer/column.rs index 68813193..41143d65 100644 --- a/src/postgres/writer/column.rs +++ b/src/postgres/writer/column.rs @@ -93,8 +93,7 @@ impl ColumnInfo { col_def = col_def.text(); } Type::Bytea => { - // col_def = col_def.binary(); - col_def = col_def.extra("bytea".to_owned()); + col_def = col_def.binary(); } Type::Timestamp(time_attr) => { col_def = match time_attr.precision { @@ -128,86 +127,88 @@ impl ColumnInfo { col_def = col_def.boolean(); } Type::Point => { - col_def = col_def.extra("point".to_owned()); + col_def = col_def.custom(Alias::new("point")); } Type::Line => { - col_def = col_def.extra("line".to_owned()); + col_def = col_def.custom(Alias::new("line")); } Type::Lseg => { - col_def = col_def.extra("lseg".to_owned()); + col_def = col_def.custom(Alias::new("lseg")); } Type::Box => { - col_def = col_def.extra("box".to_owned()); + col_def = col_def.custom(Alias::new("box")); } Type::Path => { - col_def = col_def.extra("path".to_owned()); + col_def = col_def.custom(Alias::new("path")); } Type::Polygon => { - col_def = col_def.extra("ploygon".to_owned()); + col_def = col_def.custom(Alias::new("ploygon")); } Type::Circle => { - col_def = col_def.extra("circle".to_owned()); + col_def = col_def.custom(Alias::new("circle")); } Type::Cidr => { - col_def = col_def.extra("cidr".to_owned()); + col_def = col_def.custom(Alias::new("cidr")); } Type::Inet => { - col_def = col_def.extra("inet".to_owned()); + col_def = col_def.custom(Alias::new("inet")); } Type::MacAddr => { - col_def = col_def.extra("macaddr".to_owned()); + col_def = col_def.custom(Alias::new("macaddr")); } Type::MacAddr8 => { - col_def = col_def.extra("macaddr8".to_owned()); + col_def = col_def.custom(Alias::new("macaddr8")); } Type::Bit(bit_attr) => { - col_def = col_def.extra("bit".to_owned()); + let mut str = String::new(); + write!(str, "bit"); if bit_attr.length.is_some() { - col_def = col_def.extra("(".to_owned()); + write!(str, "("); if let Some(length) = bit_attr.length { - col_def = col_def.extra(format!("{}", length)); + write!(str, "{}", length); } - col_def = col_def.extra(")".to_owned()); + write!(str, ")"); } + col_def = col_def.custom(Alias::new(&str)); } Type::TsVector => { - col_def = col_def.extra("tsvector".to_owned()); + col_def = col_def.custom(Alias::new("tsvector")); } Type::TsQuery => { - col_def = col_def.extra("tsquery".to_owned()); + col_def = col_def.custom(Alias::new("tsquery")); } Type::Uuid => { - col_def = col_def.extra("uuid".to_owned()); + col_def = col_def.custom(Alias::new("uuid")); } Type::Xml => { - col_def = col_def.extra("xml".to_owned()); + col_def = col_def.custom(Alias::new("xml")); } Type::Json => { - col_def = col_def.extra("json".to_owned()); + col_def = col_def.custom(Alias::new("json")); } Type::Array => { - col_def = col_def.extra("array".to_owned()); + col_def = col_def.custom(Alias::new("array")); } Type::Int4Range => { - col_def = col_def.extra("int4range".to_owned()); + col_def = col_def.custom(Alias::new("int4range")); } Type::Int8Range => { - col_def = col_def.extra("int8range".to_owned()); + col_def = col_def.custom(Alias::new("int8range")); } Type::NumRange => { - col_def = col_def.extra("numrange".to_owned()); + col_def = col_def.custom(Alias::new("numrange")); } Type::TsRange => { - col_def = col_def.extra("tsrange".to_owned()); + col_def = col_def.custom(Alias::new("tsrange")); } Type::TsTzRange => { - col_def = col_def.extra("tstzrange".to_owned()); + col_def = col_def.custom(Alias::new("tstzrange")); } Type::DateRange => { - col_def = col_def.extra("daterange".to_owned()); + col_def = col_def.custom(Alias::new("daterange")); } Type::PgLsn => { - col_def = col_def.extra("pg_lsn".to_owned()); + col_def = col_def.custom(Alias::new("pg_lsn")); } Type::Unknown(s) => { col_def = col_def.custom(Alias::new(s)); From ff16bfe7050872b940341ad443b147c7ffe0d079 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 16:00:06 +0800 Subject: [PATCH 18/21] Fixup --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 8f4bf943..4fdaa21d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ path = "src/lib.rs" [dependencies] futures = { version = "0.3", optional = true } sea-schema-derive = { version = "0.1.0", path = "sea-schema-derive" } -sea-query = { version = "^0.12", git = "https://github.com/SeaQL/sea-query.git", branch = "fix-pg-constraints" } +sea-query = { version = "^0.12", git = "https://github.com/SeaQL/sea-query.git" } serde = { version = "^1", features = ["derive"], optional = true } sqlx = { version = "^0", optional = true } From 9e66b1c69f42cb5c40610fb57587d0dbdd3a6fb2 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 18:56:37 +0800 Subject: [PATCH 19/21] Use bakery schema --- src/postgres/def/constraints.rs | 19 +++ src/postgres/parser/column.rs | 8 +- src/postgres/parser/table_constraints.rs | 8 + src/postgres/writer/constraints.rs | 34 ++-- tests/live/postgres/src/main.rs | 203 ++++++++++++++++------- 5 files changed, 192 insertions(+), 80 deletions(-) diff --git a/src/postgres/def/constraints.rs b/src/postgres/def/constraints.rs index a1c3d1dd..4093345c 100644 --- a/src/postgres/def/constraints.rs +++ b/src/postgres/def/constraints.rs @@ -1,6 +1,8 @@ #[cfg(feature = "with-serde")] use serde::{Deserialize, Serialize}; +use crate as sea_schema; + #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] /// An enum consisting of all constraints @@ -56,6 +58,23 @@ pub struct References { pub columns: Vec, pub table: String, pub foreign_columns: Vec, + pub on_update: Option, + pub on_delete: Option, +} + +#[derive(Clone, Debug, PartialEq, sea_schema_derive::Name)] +#[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] +pub enum ForeignKeyAction { + #[name = "CASCADE"] + Cascade, + #[name = "SET NULL"] + SetNull, + #[name = "SET DEFAULT"] + SetDefault, + #[name = "RESTRICT"] + Restrict, + #[name = "NO ACTION"] + NoAction, } #[derive(Clone, Debug, PartialEq)] diff --git a/src/postgres/parser/column.rs b/src/postgres/parser/column.rs index b57f39f0..791f2fe2 100644 --- a/src/postgres/parser/column.rs +++ b/src/postgres/parser/column.rs @@ -29,14 +29,10 @@ pub fn parse_column_query_result(result: ColumnQueryResult) -> ColumnInfo { pub fn parse_column_type(result: &ColumnQueryResult) -> ColumnType { let mut parser_type = Parser::new(&result.column_type); - if parser_type.curr().is_none() { + let mut ctype = if parser_type.curr().is_none() { return Type::Unknown(String::default()); - } - - let mut ctype = if let Some(word) = parser_type.next_if_unquoted_any() { - Type::from_str(word.as_str()) } else { - Type::from_str("") + Type::from_str(result.column_type.as_str()) }; if ctype.has_numeric_attr() { diff --git a/src/postgres/parser/table_constraints.rs b/src/postgres/parser/table_constraints.rs index 29520ff7..3d349941 100644 --- a/src/postgres/parser/table_constraints.rs +++ b/src/postgres/parser/table_constraints.rs @@ -48,6 +48,10 @@ impl Iterator for TableConstraintsQueryResultParser { columns.push(result.column_name.unwrap()); let table = result.referential_key_table_name.unwrap(); foreign_columns.push(result.referential_key_column_name.unwrap()); + let on_update = + ForeignKeyAction::from_str(&result.update_rule.clone().unwrap_or_default()); + let on_delete = + ForeignKeyAction::from_str(&result.delete_rule.clone().unwrap_or_default()); while let Some(result) = self.results.next() { if result.constraint_name != constraint_name { @@ -56,6 +60,8 @@ impl Iterator for TableConstraintsQueryResultParser { columns, table, foreign_columns, + on_update, + on_delete, })); } @@ -67,6 +73,8 @@ impl Iterator for TableConstraintsQueryResultParser { columns, table, foreign_columns, + on_update, + on_delete, })) } diff --git a/src/postgres/writer/constraints.rs b/src/postgres/writer/constraints.rs index b1fb4673..64852495 100644 --- a/src/postgres/writer/constraints.rs +++ b/src/postgres/writer/constraints.rs @@ -1,4 +1,4 @@ -use crate::postgres::def::{PrimaryKey, References, Unique}; +use crate::postgres::def::{ForeignKeyAction, PrimaryKey, References, Unique}; use sea_query::{Alias, ForeignKey, ForeignKeyCreateStatement, Index, IndexCreateStatement}; impl PrimaryKey { @@ -31,20 +31,24 @@ impl References { for ref_col in self.foreign_columns.iter() { key = key.to_col(Alias::new(&ref_col)); } - // key = key.on_update(match self.on_update { - // ForeignKeyAction::Cascade => sea_query::ForeignKeyAction::Cascade, - // ForeignKeyAction::SetNull => sea_query::ForeignKeyAction::SetNull, - // ForeignKeyAction::SetDefault => sea_query::ForeignKeyAction::SetDefault, - // ForeignKeyAction::Restrict => sea_query::ForeignKeyAction::Restrict, - // ForeignKeyAction::NoAction => sea_query::ForeignKeyAction::NoAction, - // }); - // key = key.on_delete(match self.on_delete { - // ForeignKeyAction::Cascade => sea_query::ForeignKeyAction::Cascade, - // ForeignKeyAction::SetNull => sea_query::ForeignKeyAction::SetNull, - // ForeignKeyAction::SetDefault => sea_query::ForeignKeyAction::SetDefault, - // ForeignKeyAction::Restrict => sea_query::ForeignKeyAction::Restrict, - // ForeignKeyAction::NoAction => sea_query::ForeignKeyAction::NoAction, - // }); + if let Some(on_update) = &self.on_update { + key = key.on_update(match on_update { + ForeignKeyAction::Cascade => sea_query::ForeignKeyAction::Cascade, + ForeignKeyAction::SetNull => sea_query::ForeignKeyAction::SetNull, + ForeignKeyAction::SetDefault => sea_query::ForeignKeyAction::SetDefault, + ForeignKeyAction::Restrict => sea_query::ForeignKeyAction::Restrict, + ForeignKeyAction::NoAction => sea_query::ForeignKeyAction::NoAction, + }); + } + if let Some(on_delete) = &self.on_delete { + key = key.on_delete(match on_delete { + ForeignKeyAction::Cascade => sea_query::ForeignKeyAction::Cascade, + ForeignKeyAction::SetNull => sea_query::ForeignKeyAction::SetNull, + ForeignKeyAction::SetDefault => sea_query::ForeignKeyAction::SetDefault, + ForeignKeyAction::Restrict => sea_query::ForeignKeyAction::Restrict, + ForeignKeyAction::NoAction => sea_query::ForeignKeyAction::NoAction, + }); + } key } } diff --git a/tests/live/postgres/src/main.rs b/tests/live/postgres/src/main.rs index c8bdd214..93e579f9 100644 --- a/tests/live/postgres/src/main.rs +++ b/tests/live/postgres/src/main.rs @@ -2,7 +2,8 @@ use std::collections::HashMap; use sea_schema::postgres::{def::TableDef, discovery::SchemaDiscovery}; use sea_schema::sea_query::{ - Alias, ColumnDef, ForeignKey, Index, PostgresQueryBuilder, Table, TableCreateStatement, + Alias, ColumnDef, ForeignKey, ForeignKeyAction, Index, PostgresQueryBuilder, Table, + TableCreateStatement, }; use sqlx::{Executor, PgPool, Pool, Postgres}; @@ -12,13 +13,17 @@ async fn main() { let mut connection = setup("postgres://sea:sea@localhost", "sea-schema").await; let mut executor = connection.acquire().await.unwrap(); - let tables = vec![ - ("actor", create_actor_table()), - ("film", create_film_table()), - ("film_actor", create_film_actor_table()), + let tbl_create_stmts = vec![ + create_bakery_table(), + create_baker_table(), + create_customer_table(), + create_order_table(), + create_cake_table(), + create_cakes_bakers_table(), + create_lineitem_table(), ]; - for (_, tbl_create_stmt) in tables.iter() { + for tbl_create_stmt in tbl_create_stmts.iter() { let sql = tbl_create_stmt.to_string(PostgresQueryBuilder); println!("{};", sql); println!(); @@ -29,15 +34,17 @@ async fn main() { let schema = schema_discovery.discover().await; + println!("{:#?}", schema); + let map: HashMap = schema .tables .iter() .map(|table| (table.info.name.clone(), table.clone())) .collect(); - for (table, tbl_create_stmt) in tables.into_iter() { + for tbl_create_stmt in tbl_create_stmts.into_iter() { let expected_sql = tbl_create_stmt.to_string(PostgresQueryBuilder); - let table = map.get(table).unwrap(); + let table = map.get(&tbl_create_stmt.get_table_name().unwrap()).unwrap(); let sql = table.write().to_string(PostgresQueryBuilder); println!("Expected SQL:"); println!("{};", expected_sql); @@ -48,7 +55,7 @@ async fn main() { } } -pub async fn setup(base_url: &str, db_name: &str) -> Pool { +async fn setup(base_url: &str, db_name: &str) -> Pool { let url = format!("{}/postgres", base_url); let mut connection = PgPool::connect(&url) .await @@ -72,91 +79,169 @@ pub async fn setup(base_url: &str, db_name: &str) -> Pool { PgPool::connect(&url).await.unwrap() } -pub fn create_actor_table() -> TableCreateStatement { +fn create_bakery_table() -> TableCreateStatement { Table::create() - .table(Alias::new("actor")) + .table(Alias::new("bakery")) .col( - ColumnDef::new(Alias::new("actor_id")) + ColumnDef::new(Alias::new("id")) .integer() - .auto_increment() - .not_null(), + .not_null() + .auto_increment(), ) + .col(ColumnDef::new(Alias::new("name")).string()) + .col(ColumnDef::new(Alias::new("profit_margin")).double()) + .primary_key(Index::create().primary().col(Alias::new("id"))) + .to_owned() +} + +fn create_baker_table() -> TableCreateStatement { + Table::create() + .table(Alias::new("baker")) .col( - ColumnDef::new(Alias::new("first_name")) - .char_len(45) - .not_null(), + ColumnDef::new(Alias::new("id")) + .integer() + .not_null() + .auto_increment(), ) - .col( - ColumnDef::new(Alias::new("last_name")) - .char_len(45) - .not_null(), + .col(ColumnDef::new(Alias::new("name")).string()) + .col(ColumnDef::new(Alias::new("contact_details")).json()) + .col(ColumnDef::new(Alias::new("bakery_id")).integer()) + .primary_key(Index::create().primary().col(Alias::new("id"))) + .foreign_key( + ForeignKey::create() + // .name("FK_baker_bakery") + .from(Alias::new("baker"), Alias::new("bakery_id")) + .to(Alias::new("bakery"), Alias::new("id")) + .on_delete(ForeignKeyAction::Cascade) + .on_update(ForeignKeyAction::Cascade), ) + .to_owned() +} + +fn create_customer_table() -> TableCreateStatement { + Table::create() + .table(Alias::new("customer")) .col( - ColumnDef::new(Alias::new("last_update")) - .timestamp_len(6) + ColumnDef::new(Alias::new("id")) + .integer() .not_null() - .extra("DEFAULT now()".to_owned()), + .auto_increment(), ) - .primary_key(Index::create().primary().col(Alias::new("actor_id"))) + .col(ColumnDef::new(Alias::new("name")).string()) + .col(ColumnDef::new(Alias::new("notes")).text()) + .primary_key(Index::create().primary().col(Alias::new("id"))) .to_owned() } -pub fn create_film_table() -> TableCreateStatement { +fn create_order_table() -> TableCreateStatement { Table::create() - .table(Alias::new("film")) + .table(Alias::new("order")) .col( - ColumnDef::new(Alias::new("film_id")) + ColumnDef::new(Alias::new("id")) .integer() - .auto_increment() - .not_null(), + .not_null() + .auto_increment(), ) - .col(ColumnDef::new(Alias::new("title")).char_len(255).not_null()) - .col(ColumnDef::new(Alias::new("description")).text()) + .col(ColumnDef::new(Alias::new("total")).decimal_len(19, 4)) + .col(ColumnDef::new(Alias::new("bakery_id")).integer().not_null()) .col( - ColumnDef::new(Alias::new("rental_rate")) - .decimal_len(4, 2) - .not_null() - .default(4.99), + ColumnDef::new(Alias::new("customer_id")) + .integer() + .not_null(), ) .col( - ColumnDef::new(Alias::new("last_update")) + ColumnDef::new(Alias::new("placed_at")) .timestamp_len(6) - .not_null() - .extra("DEFAULT now()".to_owned()), + .not_null(), + ) + .primary_key(Index::create().primary().col(Alias::new("id"))) + .foreign_key( + ForeignKey::create() + // .name("FK_order_bakery") + .from(Alias::new("order"), Alias::new("bakery_id")) + .to(Alias::new("bakery"), Alias::new("id")) + .on_delete(ForeignKeyAction::Cascade) + .on_update(ForeignKeyAction::Cascade), + ) + .foreign_key( + ForeignKey::create() + // .name("FK_order_customer") + .from(Alias::new("order"), Alias::new("customer_id")) + .to(Alias::new("customer"), Alias::new("id")) + .on_delete(ForeignKeyAction::Cascade) + .on_update(ForeignKeyAction::Cascade), ) - .primary_key(Index::create().primary().col(Alias::new("film_id"))) - .index(Index::create().unique().col(Alias::new("title"))) .to_owned() } -pub fn create_film_actor_table() -> TableCreateStatement { +fn create_lineitem_table() -> TableCreateStatement { Table::create() - .table(Alias::new("film_actor")) - .col(ColumnDef::new(Alias::new("actor_id")).integer().not_null()) - .col(ColumnDef::new(Alias::new("film_id")).integer().not_null()) + .table(Alias::new("lineitem")) .col( - ColumnDef::new(Alias::new("last_update")) - .timestamp_len(6) + ColumnDef::new(Alias::new("id")) + .integer() .not_null() - .extra("DEFAULT now()".to_owned()), + .auto_increment(), ) - .primary_key( - Index::create() - .primary() - .col(Alias::new("actor_id")) - .col(Alias::new("film_id")), + .col(ColumnDef::new(Alias::new("price")).decimal_len(19, 4)) + .col(ColumnDef::new(Alias::new("quantity")).integer()) + .col(ColumnDef::new(Alias::new("order_id")).integer().not_null()) + .col(ColumnDef::new(Alias::new("cake_id")).integer().not_null()) + .primary_key(Index::create().primary().col(Alias::new("id"))) + .foreign_key( + ForeignKey::create() + // .name("FK_lineitem_cake") + .from(Alias::new("lineitem"), Alias::new("cake_id")) + .to(Alias::new("cake"), Alias::new("id")) + .on_delete(ForeignKeyAction::Cascade) + .on_update(ForeignKeyAction::Cascade), ) .foreign_key( ForeignKey::create() - .to_tbl(Alias::new("actor")) - .from_col(Alias::new("actor_id")) - .to_col(Alias::new("actor_id")), + // .name("FK_lineitem_order") + .from(Alias::new("lineitem"), Alias::new("order_id")) + .to(Alias::new("order"), Alias::new("id")) + .on_delete(ForeignKeyAction::Cascade) + .on_update(ForeignKeyAction::Cascade), + ) + .to_owned() +} + +fn create_cakes_bakers_table() -> TableCreateStatement { + Table::create() + .table(Alias::new("cakes_bakers")) + .col(ColumnDef::new(Alias::new("cake_id")).integer().not_null()) + .col(ColumnDef::new(Alias::new("baker_id")).integer().not_null()) + .primary_key( + Index::create() + .col(Alias::new("cake_id")) + .col(Alias::new("baker_id")), + ) + .to_owned() +} + +fn create_cake_table() -> TableCreateStatement { + Table::create() + .table(Alias::new("cake")) + .col( + ColumnDef::new(Alias::new("id")) + .integer() + .not_null() + .auto_increment(), ) + .col(ColumnDef::new(Alias::new("name")).string()) + .col(ColumnDef::new(Alias::new("price")).decimal_len(19, 4)) + .col(ColumnDef::new(Alias::new("bakery_id")).integer().not_null()) + .col(ColumnDef::new(Alias::new("gluten_free")).boolean()) + .col(ColumnDef::new(Alias::new("serial")).uuid()) + .primary_key(Index::create().primary().col(Alias::new("id"))) .foreign_key( ForeignKey::create() - .to_tbl(Alias::new("film")) - .from_col(Alias::new("film_id")) - .to_col(Alias::new("film_id")), + // .name("FK_cake_bakery") + .from(Alias::new("cake"), Alias::new("bakery_id")) + .to(Alias::new("bakery"), Alias::new("id")) + .on_delete(ForeignKeyAction::Cascade) + .on_update(ForeignKeyAction::Cascade), ) .to_owned() } From 8a6d3c049a11c895ad9d4ee83f379742402852cc Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Tue, 3 Aug 2021 22:17:17 +0800 Subject: [PATCH 20/21] All constraints with name --- src/postgres/def/constraints.rs | 13 +++++- src/postgres/parser/table_constraints.rs | 23 ++++++++-- src/postgres/writer/constraints.rs | 10 ++--- tests/live/postgres/src/main.rs | 55 ++++++++++++++++++------ 4 files changed, 78 insertions(+), 23 deletions(-) diff --git a/src/postgres/def/constraints.rs b/src/postgres/def/constraints.rs index 4093345c..c1403128 100644 --- a/src/postgres/def/constraints.rs +++ b/src/postgres/def/constraints.rs @@ -19,6 +19,7 @@ pub enum Constraint { #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] /// A constraint which states that a value must satisfy the following Boolean expression pub struct Check { + pub name: String, /// The Boolean expression that must be satisfied pub expr: String, /// If marked with NO INHERIT, the constraint will not propogate to child tables @@ -43,18 +44,25 @@ impl NotNull { #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] /// That each set of values for these columns must be unique across the whole table -pub struct Unique(pub Vec); +pub struct Unique { + pub name: String, + pub columns: Vec, +} #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] /// A constraint stating that the given columns act as a unique identifier for rows in the table. /// This implies that the columns are not null and are unique together -pub struct PrimaryKey(pub Vec); +pub struct PrimaryKey { + pub name: String, + pub columns: Vec, +} #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "with-serde", derive(Serialize, Deserialize))] /// A constraint that column references the values appearing in the row of another table pub struct References { + pub name: String, pub columns: Vec, pub table: String, pub foreign_columns: Vec, @@ -83,6 +91,7 @@ pub enum ForeignKeyAction { /// expressions using the specified operators, at least one of these operator comparisons returns /// false or null pub struct Exclusion { + pub name: String, pub using: String, pub columns: Vec, pub operation: String, diff --git a/src/postgres/parser/table_constraints.rs b/src/postgres/parser/table_constraints.rs index 3d349941..d4fe2f11 100644 --- a/src/postgres/parser/table_constraints.rs +++ b/src/postgres/parser/table_constraints.rs @@ -35,6 +35,7 @@ impl Iterator for TableConstraintsQueryResultParser { match result.constraint_type.as_str() { "CHECK" => { Some(Constraint::Check(Check { + name: constraint_name, expr: result.check_clause.unwrap().to_string(), // TODO: How to find? no_inherit: false, @@ -57,6 +58,7 @@ impl Iterator for TableConstraintsQueryResultParser { if result.constraint_name != constraint_name { self.curr = Some(result); return Some(Constraint::References(References { + name: constraint_name, columns, table, foreign_columns, @@ -70,6 +72,7 @@ impl Iterator for TableConstraintsQueryResultParser { } Some(Constraint::References(References { + name: constraint_name, columns, table, foreign_columns, @@ -86,13 +89,19 @@ impl Iterator for TableConstraintsQueryResultParser { while let Some(result) = self.results.next() { if result.constraint_name != constraint_name { self.curr = Some(result); - return Some(Constraint::PrimaryKey(PrimaryKey(columns))); + return Some(Constraint::PrimaryKey(PrimaryKey { + name: constraint_name, + columns, + })); } columns.push(result.column_name.unwrap()); } - Some(Constraint::PrimaryKey(PrimaryKey(columns))) + Some(Constraint::PrimaryKey(PrimaryKey { + name: constraint_name, + columns, + })) } "UNIQUE" => { @@ -103,13 +112,19 @@ impl Iterator for TableConstraintsQueryResultParser { while let Some(result) = self.results.next() { if result.constraint_name != constraint_name { self.curr = Some(result); - return Some(Constraint::Unique(Unique(columns))); + return Some(Constraint::Unique(Unique { + name: constraint_name, + columns, + })); } columns.push(result.column_name.unwrap()); } - Some(Constraint::Unique(Unique(columns))) + Some(Constraint::Unique(Unique { + name: constraint_name, + columns, + })) } _ => { diff --git a/src/postgres/writer/constraints.rs b/src/postgres/writer/constraints.rs index 64852495..44e8666e 100644 --- a/src/postgres/writer/constraints.rs +++ b/src/postgres/writer/constraints.rs @@ -3,8 +3,8 @@ use sea_query::{Alias, ForeignKey, ForeignKeyCreateStatement, Index, IndexCreate impl PrimaryKey { pub fn write(&self) -> IndexCreateStatement { - let mut idx = Index::create().primary(); - for col in self.0.iter() { + let mut idx = Index::create().primary().name(&self.name); + for col in self.columns.iter() { idx = idx.col(Alias::new(col)); } idx @@ -13,8 +13,8 @@ impl PrimaryKey { impl Unique { pub fn write(&self) -> IndexCreateStatement { - let mut idx = Index::create().unique(); - for col in self.0.iter() { + let mut idx = Index::create().unique().name(&self.name); + for col in self.columns.iter() { idx = idx.col(Alias::new(col)); } idx @@ -23,7 +23,7 @@ impl Unique { impl References { pub fn write(&self) -> ForeignKeyCreateStatement { - let mut key = ForeignKey::create(); + let mut key = ForeignKey::create().name(&self.name); key = key.to_tbl(Alias::new(&self.table)); for column in self.columns.iter() { key = key.from_col(Alias::new(&column)); diff --git a/tests/live/postgres/src/main.rs b/tests/live/postgres/src/main.rs index 93e579f9..d081229a 100644 --- a/tests/live/postgres/src/main.rs +++ b/tests/live/postgres/src/main.rs @@ -90,7 +90,12 @@ fn create_bakery_table() -> TableCreateStatement { ) .col(ColumnDef::new(Alias::new("name")).string()) .col(ColumnDef::new(Alias::new("profit_margin")).double()) - .primary_key(Index::create().primary().col(Alias::new("id"))) + .primary_key( + Index::create() + .primary() + .name("bakery_pkey") + .col(Alias::new("id")), + ) .to_owned() } @@ -106,10 +111,15 @@ fn create_baker_table() -> TableCreateStatement { .col(ColumnDef::new(Alias::new("name")).string()) .col(ColumnDef::new(Alias::new("contact_details")).json()) .col(ColumnDef::new(Alias::new("bakery_id")).integer()) - .primary_key(Index::create().primary().col(Alias::new("id"))) + .primary_key( + Index::create() + .primary() + .name("baker_pkey") + .col(Alias::new("id")), + ) .foreign_key( ForeignKey::create() - // .name("FK_baker_bakery") + .name("FK_baker_bakery") .from(Alias::new("baker"), Alias::new("bakery_id")) .to(Alias::new("bakery"), Alias::new("id")) .on_delete(ForeignKeyAction::Cascade) @@ -129,7 +139,12 @@ fn create_customer_table() -> TableCreateStatement { ) .col(ColumnDef::new(Alias::new("name")).string()) .col(ColumnDef::new(Alias::new("notes")).text()) - .primary_key(Index::create().primary().col(Alias::new("id"))) + .primary_key( + Index::create() + .primary() + .name("customer_pkey") + .col(Alias::new("id")), + ) .to_owned() } @@ -154,10 +169,15 @@ fn create_order_table() -> TableCreateStatement { .timestamp_len(6) .not_null(), ) - .primary_key(Index::create().primary().col(Alias::new("id"))) + .primary_key( + Index::create() + .primary() + .name("order_pkey") + .col(Alias::new("id")), + ) .foreign_key( ForeignKey::create() - // .name("FK_order_bakery") + .name("FK_order_bakery") .from(Alias::new("order"), Alias::new("bakery_id")) .to(Alias::new("bakery"), Alias::new("id")) .on_delete(ForeignKeyAction::Cascade) @@ -165,7 +185,7 @@ fn create_order_table() -> TableCreateStatement { ) .foreign_key( ForeignKey::create() - // .name("FK_order_customer") + .name("FK_order_customer") .from(Alias::new("order"), Alias::new("customer_id")) .to(Alias::new("customer"), Alias::new("id")) .on_delete(ForeignKeyAction::Cascade) @@ -187,10 +207,15 @@ fn create_lineitem_table() -> TableCreateStatement { .col(ColumnDef::new(Alias::new("quantity")).integer()) .col(ColumnDef::new(Alias::new("order_id")).integer().not_null()) .col(ColumnDef::new(Alias::new("cake_id")).integer().not_null()) - .primary_key(Index::create().primary().col(Alias::new("id"))) + .primary_key( + Index::create() + .primary() + .name("lineitem_pkey") + .col(Alias::new("id")), + ) .foreign_key( ForeignKey::create() - // .name("FK_lineitem_cake") + .name("FK_lineitem_cake") .from(Alias::new("lineitem"), Alias::new("cake_id")) .to(Alias::new("cake"), Alias::new("id")) .on_delete(ForeignKeyAction::Cascade) @@ -198,7 +223,7 @@ fn create_lineitem_table() -> TableCreateStatement { ) .foreign_key( ForeignKey::create() - // .name("FK_lineitem_order") + .name("FK_lineitem_order") .from(Alias::new("lineitem"), Alias::new("order_id")) .to(Alias::new("order"), Alias::new("id")) .on_delete(ForeignKeyAction::Cascade) @@ -214,6 +239,7 @@ fn create_cakes_bakers_table() -> TableCreateStatement { .col(ColumnDef::new(Alias::new("baker_id")).integer().not_null()) .primary_key( Index::create() + .name("cakes_bakers_pkey") .col(Alias::new("cake_id")) .col(Alias::new("baker_id")), ) @@ -234,10 +260,15 @@ fn create_cake_table() -> TableCreateStatement { .col(ColumnDef::new(Alias::new("bakery_id")).integer().not_null()) .col(ColumnDef::new(Alias::new("gluten_free")).boolean()) .col(ColumnDef::new(Alias::new("serial")).uuid()) - .primary_key(Index::create().primary().col(Alias::new("id"))) + .primary_key( + Index::create() + .primary() + .name("cake_pkey") + .col(Alias::new("id")), + ) .foreign_key( ForeignKey::create() - // .name("FK_cake_bakery") + .name("FK_cake_bakery") .from(Alias::new("cake"), Alias::new("bakery_id")) .to(Alias::new("bakery"), Alias::new("id")) .on_delete(ForeignKeyAction::Cascade) From 5cfe0cc22c05ffb00f512515a248b991152e56a5 Mon Sep 17 00:00:00 2001 From: Billy Chan Date: Wed, 4 Aug 2021 14:46:13 +0800 Subject: [PATCH 21/21] Update GitHub Actions --- .github/workflows/rust.yml | 42 +++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3e6f5962..736e72b7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -15,9 +15,37 @@ jobs: test: name: Unit Test runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - uses: Swatinem/rust-cache@v1 + + - uses: actions-rs/cargo@v1 + with: + command: build + args: > + --all + + - uses: actions-rs/cargo@v1 + with: + command: test + + postgres: + name: Postgres + runs-on: ubuntu-20.04 + strategy: + matrix: + version: [13.3, 12.7, 11.12, 10.17, 9.6.22] + project: [live] services: postgres: - image: postgres:11 + image: postgres:${{ matrix.version }} env: POSTGRES_HOST: 127.0.0.1 POSTGRES_USER: sea @@ -38,22 +66,16 @@ jobs: toolchain: stable override: true - - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-test-${{ hashFiles('**/Cargo.lock') }} + - uses: Swatinem/rust-cache@v1 - uses: actions-rs/cargo@v1 with: command: build args: > - --all + --manifest-path tests/${{ matrix.project }}/postgres/Cargo.toml - uses: actions-rs/cargo@v1 with: command: test args: > - --all + --manifest-path tests/${{ matrix.project }}/postgres/Cargo.toml